10.5 External Definitions
The MPLAB XC-DSC C Compiler provides an
include file, stdfix.h
, which provides constant, pragma, typedef, and
function definitions as described in section 7.18a of N1169.
Fixed point conversion specifiers for formatted I/O, as described in
section 4.1.9 “Formatted I/O functions for fixed-point arguments” of N1169, are not
supported in the current MPLAB XC-DSC standard C libraries.
Fixed-point variables may be displayed via (s)printf
by casting them to
the appropriate floating point representation (double
for
_Fract
, long double
for long _Fract
and _Accum
) and then displaying the value in that format. To scan a
fixed-point number via (s)scanf
, first scan it as the appropriate
double
or long double
floating point number and then
cast the value obtained to the desired fixed-point type.
The fixed point functions described in section 4.1.7 of N1169 are not provided in the current MPLAB XC-DSC standard C libraries.
Fixed point constants, with suffixes of k
(K
) and r
(R
), as described in
section 4.1.5 of N1169, are supported by the MPLAB XC-DSC C Compiler.