We have 2 built-in projects. One of them uses a space compiler, and the other uses GCC. Both adhere to ISO / IEC 9899: 1990.
When we initialize a float with the literal 14.8f, it translates to binary representation 0x416CCCCC on the space compiler and 0x416CCCCD on GCC.
IEC standard in chapter 6.2.1.4 Status of floating types:
If the value being converted is in the range of values that can be represented but
cannot be represented exactly, the result is either the nearest higher or nearest lower value, chosen in an implementation-defined manner.
since we use these numbers as thresholds, this obviously matters. The space compiler claims to use a rounded implementation. Since GCC is quite complex, I was wondering if it has a compiler flag that allows you to choose behavior at compile time. So far, I have found that you can select FE_DOWNWARD, but this is due to runtime, not compilation.
Does anyone have a key for this flag to convert compile time?
source
share