[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#166255: ada/8606: GNAT floating point optimization bug



Indeed the issue here is the standard one of double rounding for
64-bit floating point types. There is nothing Ada-specific about
this and these problems are identical in C. The -ffloat-store
option may improve repeatability, but has two undesired effects:
it degrades performance and it always causes double rounding,
which can degrade accuracy.

For numerical code that requires exact rounding, only use 32-bit
or 80-bit floating point types. When you need an expression to
be computed to exactly 32 bits without any excess precision,
store it to a volatile variable.

If you really need 64-bit types with exact rounding, you'll have
to set the rounding mode accordingly, but this will need changes
in the Ada run time to prevent it from using 80-bit types.

  -Geert




Reply to: