Microchip Technology SW006022-2N Data Sheet

Page of 338
Supported Data Types and Variables
 2012 Microchip Technology Inc.
DS52071B-page 95
6.3.2
char Types
The compiler supports data types for char, which defaults to signed char. An option 
can be used to use unsigned char as the default, see Section 3.7.3 “Options for 
Controlling the C Dialect”
.
It is a common misconception that the C char types are intended purely for ASCII char-
acter manipulation. This is not true; indeed, the C language makes no guarantee that 
the default character representation is even ASCII (however, this implementation does 
use ASCII as the character representation). The char types are simply the smallest of 
the multi-bit integer sizes, and behave in all respects like integers. The reason for the 
name “char” is historical and does not mean that char can only be used to represent 
characters. It is possible to freely mix char values with values of other types in C 
expressions. With the MPLAB XC16 C Compiler, the char types will commonly be 
used for a number of purposes: as 8-bit integers, as storage for ASCII characters, and 
for access to I/O locations.
6.4
FLOATING-POINT DATA TYPES
The compiler uses the IEEE-754 format. Table 6-2 shows floating point data types that 
are supported. All floating point data types are arithmetic type real.
All floating point values are specified in little endian format, which means:
• The least significant byte is stored at the lowest address
• The least significant bit is stored at the lowest-numbered bit position
As an example, the double value of 1.2345678 is stored at address 0x100 as follows: 
As another example, the long value of 1.2345678 is stored in registers w4 and w5: 
Floating-point types are always signed and the unsigned keyword is illegal when 
specifying a floating-point type.
Preprocessor macros that specify valid ranges are available after including 
<float.h>
 in your source code
.
For information on implementation-defined behavior of floating point numbers, see 
section Section A.7 “Floating Point”.
TABLE 6-2:
FLOATING POINT DATA TYPES
Type
Bits
E Min
E Max
N Min
N Max
float
32
-126
127
2
-126
2
128
double
*
32
-126
127
2
-126
2
128
long double
64
-1022
1023
2
-1022
2
1024
E = Exponent
N = Normalized (approximate)
* double is equivalent to long double if -fno-short-double is used.
0x100
0x101
0x102
0X103
0x51
0x06
0x9E
0x3F
w4
w5
0x0651
0x3F9E