gccint: Floating Point

1 
1 18.22 Cross Compilation and Floating Point
1 ==========================================
1 
1 While all modern machines use twos-complement representation for
1 integers, there are a variety of representations for floating point
1 numbers.  This means that in a cross-compiler the representation of
1 floating point numbers in the compiled program may be different from
1 that used in the machine doing the compilation.
1 
1  Because different representation systems may offer different amounts of
1 range and precision, all floating point constants must be represented in
1 the target machine's format.  Therefore, the cross compiler cannot
1 safely use the host machine's floating point arithmetic; it must emulate
1 the target's arithmetic.  To ensure consistency, GCC always uses
1 emulation to work with floating point values, even when the host and
1 target floating point formats are identical.
1 
1  The following macros are provided by 'real.h' for the compiler to use.
1 All parts of the compiler which generate or optimize floating-point
1 calculations must use these macros.  They may evaluate their operands
1 more than once, so operands must not have side effects.
1 
1  -- Macro: REAL_VALUE_TYPE
1      The C data type to be used to hold a floating point value in the
1      target machine's format.  Typically this is a 'struct' containing
1      an array of 'HOST_WIDE_INT', but all code should treat it as an
1      opaque quantity.
1 
1  -- Macro: HOST_WIDE_INT REAL_VALUE_FIX (REAL_VALUE_TYPE X)
1      Truncates X to a signed integer, rounding toward zero.
1 
1  -- Macro: unsigned HOST_WIDE_INT REAL_VALUE_UNSIGNED_FIX
1           (REAL_VALUE_TYPE X)
1      Truncates X to an unsigned integer, rounding toward zero.  If X is
1      negative, returns zero.
1 
1  -- Macro: REAL_VALUE_TYPE REAL_VALUE_ATOF (const char *STRING,
1           machine_mode MODE)
1      Converts STRING into a floating point number in the target
1      machine's representation for mode MODE.  This routine can handle
1      both decimal and hexadecimal floating point constants, using the
1      syntax defined by the C language for both.
1 
1  -- Macro: int REAL_VALUE_NEGATIVE (REAL_VALUE_TYPE X)
1      Returns 1 if X is negative (including negative zero), 0 otherwise.
1 
1  -- Macro: int REAL_VALUE_ISINF (REAL_VALUE_TYPE X)
1      Determines whether X represents infinity (positive or negative).
1 
1  -- Macro: int REAL_VALUE_ISNAN (REAL_VALUE_TYPE X)
1      Determines whether X represents a "NaN" (not-a-number).
1 
1  -- Macro: REAL_VALUE_TYPE REAL_VALUE_NEGATE (REAL_VALUE_TYPE X)
1      Returns the negative of the floating point value X.
1 
1  -- Macro: REAL_VALUE_TYPE REAL_VALUE_ABS (REAL_VALUE_TYPE X)
1      Returns the absolute value of X.
1