# General Notes Concerning Library Code

The following points relate to the general usage of functions within the library.

## MPLAB XC8 Functions With Floating-point Arguments

With the MPLAB XC8 compiler (for both PIC and AVR targets), the double and long double types are the same size and format as the 32-bit float type. Many math-related functions have separate implementations for each of the three floating-point types (e.g. acos for double types, acosl for long double types, and acosf for float types). In these cases, only the float instance of the function is fully implemented. Calls to either the double or long double variants of the functions will be mapped to the float implementation.

## MPLAB XC16 and double Types

By default, the MPLAB XC16 compiler uses a double type equivalent to float, which is 32 bit wide. The -fno-short-double option makes double equivalent to long double, which is 64 bit wide. The characteristics of floating-point numbers, described in <float.h> Floating-Point Characteristics, change with the use of this option, as indicated.

## MPLAB XC8 For AVR Functions With Pointers Arguments

The MPLAB XC8 Compiler for AVR can store objects qualified const into program memory (rather than data memory) and allow pointers to const types to access such objects. The feature is only available for some devices and is enabled using the -mconst-data-in-progmem option. When enabled, pointers to a const-qualified type are treated differently to similar pointers without the const qualifier, so for example the addresses held by pointers of type char * and const char * are interpreted as belonging to different address spaces.

To accommodate this feature, a different library is linked in when the feature is enabled, and the type of any library function argument or return value that is a pointer to a non-const-qualified type becomes a const-qualified version of that type. For example, with the -mconst-data-in-progmem option specified, the prototype for the strtof function, which is specified in the C standard as:
float strtof(const char * __restrict, char ** __restrict);
becomes:
float strtof(const char * __restrict, const char ** __restrict);
This change might affect how your program should be defined.