Mikroelektronika MIKROE-738 Datenbogen

Seite von 682
198
mikoC PRO for PIC32
MikroElektronika
Floating-point Types
The types 
float 
and 
double
, together with the 
long double
 variant, are considered to be floating-point types. The 
mikroC PRO for PIC32’s implementation of an ANSI Standard considers all three to be the same type.
Floating  point  in  the  mikroC  PRO  for  PIC32  is  implemented  using  the  Microchip AN575  32-bit  format  (IEEE  754 
compliant).
An overview of the floating-point types is shown in the table below:
Type
Size in bytes
Range
float
4
-1.5 * 1045 .. +3.4 * 1038
double
4
-1.5 * 1045 .. +3.4 * 1038
long double
4
-1.5 * 1045 .. +3.4 * 1038
Enumerations
An  enumeration  data  type  is  used  for  representing  an  abstract,  discreet  set  of  values  with  appropriate  symbolic 
names.
Enumeration Declaration
Enumeration is declared like this:
enum tag {enumeration-list};
Here, 
tag
 is an optional name of the enumeration; 
enumeration-list
 is a comma-delimited list of discreet values, 
enumerators (or enumeration constants). Each enumerator is assigned a fixed integral value. In the absence of explicit 
initializers, the first enumerator is set to zero, and the value of each succeeding enumerator is set to a value of its 
predecessor increased by one.
Variables  of  the 
enum
  type  are  declared  the  same  as  variables  of  any  other  type.  For  example,  the  following 
declaration:
enum colors { black, red, green, blue, violet, white } c;
establishes a unique integral type, 
enum colors
, variable c of this type, and set of enumerators with constant integer 
values (black = 0, red = 1, ...). In the mikroC PRO for PIC32, a variable of an enumerated type can be assigned any 
value of the type 
int
 – no type checking beyond that is enforced. That is: 
c = red;     // OK
c = 1;       // Also OK, means the same