3.16 Floating Point Support

Next: 3.17 Library Routines Up: 3. Using SDCC Previous: 3.15 int (16 bit) Contents Index

#
3.16 Floating Point Support

SDCC supports IEEE (single precision 4 bytes) floating point numbers. The floating point support routines are derived from gcc's floatlib.c and consist of the following routines:

Function | Description
_fsadd.c | add floating point numbers
_fssub.c | subtract floating point numbers
_fsdiv.c | divide floating point numbers
_fsmul.c | multiply floating point numbers
_fs2uchar.c | convert floating point to unsigned char
_fs2char.c | convert floating point to signed char
_fs2uint.c | convert floating point to unsigned int
_fs2int.c | convert floating point to signed int
_fs2ulong.c | convert floating point to unsigned long
_fs2long.c | convert floating point to signed long
_uchar2fs.c | convert unsigned char to floating point
_char2fs.c | convert char to floating point number
_uint2fs.c | convert unsigned int to floating point
_int2fs.c | convert int to floating point numbers
_ulong2fs.c | convert unsigned long to floating point number
_long2fs.c | convert long to floating point number

These support routines are developed in ANSI-C so there is room for space and speed improvement3.8. Note if all these routines are used simultaneously the data space might overflow. For serious floating point usage the large model might be needed. Also notice that you don't have to call this routines directly. The compiler will use them automatically every time a floating point operation is required.

Next: 3.17 Library Routines Up: 3. Using SDCC Previous: 3.15 int (16 bit) Contents Index