[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |

While all modern machines use 2's complement representation for integers, there are a variety of representations for floating point numbers. This means that in a cross-compiler the representation of floating point numbers in the compiled program may be different from that used in the machine doing the compilation.

Because different representation systems may offer different amounts of
range and precision, the cross compiler cannot safely use the host
machine's floating point arithmetic. Therefore, floating point constants
must be represented in the target machine's format. This means that the
cross compiler cannot use `atof`

to parse a floating point constant;
it must have its own special routine to use instead. Also, constant
folding must emulate the target machine's arithmetic (or must not be done
at all).

The macros in the following table should be defined only if you are cross compiling between different floating point formats.

Otherwise, don't define them. Then default definitions will be set up which
use `double`

as the data type, `==`

to test for equality, etc.

You don't need to worry about how many times you use an operand of any of these macros. The compiler never uses operands which have side effects.

`REAL_VALUE_TYPE`

- A macro for the C data type to be used to hold a floating point value
in the target machine's format. Typically this would be a
`struct`

containing an array of`int`

. `REAL_VALUES_EQUAL (`

`x`,`y`)- A macro for a C expression which compares for equality the two values,
`x`and`y`, both of type`REAL_VALUE_TYPE`

. `REAL_VALUES_LESS (`

`x`,`y`)- A macro for a C expression which tests whether
`x`is less than`y`, both values being of type`REAL_VALUE_TYPE`

and interpreted as floating point numbers in the target machine's representation. `REAL_VALUE_LDEXP (`

`x`,`scale`)- A macro for a C expression which performs the standard library
function
`ldexp`

, but using the target machine's floating point representation. Both`x`and the value of the expression have type`REAL_VALUE_TYPE`

. The second argument,`scale`, is an integer. `REAL_VALUE_FIX (`

`x`)- A macro whose definition is a C expression to convert the target-machine
floating point value
`x`to a signed integer.`x`has type`REAL_VALUE_TYPE`

. `REAL_VALUE_UNSIGNED_FIX (`

`x`)- A macro whose definition is a C expression to convert the target-machine
floating point value
`x`to an unsigned integer.`x`has type`REAL_VALUE_TYPE`

. `REAL_VALUE_RNDZINT (`

`x`)- A macro whose definition is a C expression to round the target-machine
floating point value
`x`towards zero to an integer value (but still as a floating point number).`x`has type`REAL_VALUE_TYPE`

, and so does the value. `REAL_VALUE_UNSIGNED_RNDZINT (`

`x`)- A macro whose definition is a C expression to round the target-machine
floating point value
`x`towards zero to an unsigned integer value (but still represented as a floating point number).`x`has type`REAL_VALUE_TYPE`

, and so does the value. `REAL_VALUE_ATOF (`

`string`,`mode`)- A macro for a C expression which converts
`string`, an expression of type`char *`

, into a floating point number in the target machine's representation for mode`mode`. The value has type`REAL_VALUE_TYPE`

. `REAL_INFINITY`

- Define this macro if infinity is a possible floating point value, and therefore division by 0 is legitimate.
`REAL_VALUE_ISINF (`

`x`)- A macro for a C expression which determines whether
`x`, a floating point value, is infinity. The value has type`int`

. By default, this is defined to call`isinf`

. `REAL_VALUE_ISNAN (`

`x`)- A macro for a C expression which determines whether
`x`, a floating point value, is a "nan" (not-a-number). The value has type`int`

. By default, this is defined to call`isnan`

.

Define the following additional macros if you want to make floating point constant folding work while cross compiling. If you don't define them, cross compilation is still possible, but constant folding will not happen for floating point values.

`REAL_ARITHMETIC (`

`output`,`code`,`x`,`y`)- A macro for a C statement which calculates an arithmetic operation of
the two floating point values
`x`and`y`, both of type`REAL_VALUE_TYPE`

in the target machine's representation, to produce a result of the same type and representation which is stored in`output`(which will be a variable).The operation to be performed is specified by

`code`, a tree code which will always be one of the following:`PLUS_EXPR`

,`MINUS_EXPR`

,`MULT_EXPR`

,`RDIV_EXPR`

,`MAX_EXPR`

,`MIN_EXPR`

.The expansion of this macro is responsible for checking for overflow. If overflow happens, the macro expansion should execute the statement

`return 0;`

, which indicates the inability to perform the arithmetic operation requested. `REAL_VALUE_NEGATE (`

`x`)- A macro for a C expression which returns the negative of the floating
point value
`x`. Both`x`and the value of the expression have type`REAL_VALUE_TYPE`

and are in the target machine's floating point representation.There is no way for this macro to report overflow, since overflow can't happen in the negation operation.

`REAL_VALUE_TRUNCATE (`

`mode`,`x`)- A macro for a C expression which converts the floating point value
`x`to mode`mode`.Both

`x`and the value of the expression are in the target machine's floating point representation and have type`REAL_VALUE_TYPE`

. However, the value should have an appropriate bit pattern to be output properly as a floating constant whose precision accords with mode`mode`.There is no way for this macro to report overflow.

`REAL_VALUE_TO_INT (`

`low`,`high`,`x`)- A macro for a C expression which converts a floating point value
`x`into a double-precision integer which is then stored into`low`and`high`, two variables of type`int`. `REAL_VALUE_FROM_INT (`

`x`,`low`,`high`,`mode`)-
A macro for a C expression which converts a double-precision integer
found in
`low`and`high`, two variables of type`int`, into a floating point value which is then stored into`x`. The value is in the target machine's representation for mode`mode`and has the type`REAL_VALUE_TYPE`

.

[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |

This document was generated by