misc/35381: incorrect floating-point display of large values when using round-upward IEEE mode

David Schultz das at FreeBSD.ORG
Thu Jul 14 18:54:38 GMT 2005


This does not occur in FreeBSD 5.X.  It's unlikely that the issue
will be fixed in 4.X because the fix involves importing an updated
version of a library and making substantial changes to libc.

I reported some related problems to the author of gdtoa (which is
the library we use to perform this type of conversion) some months
ago.  These bugs affect 5.X and 6-CURRENT, although technically
speaking fixing them is not required (only recommended) by POSIX.

| - When FLT_ROUNDS is 3 (round downward), strtod() converts
|   the string "0x1.ffffffffffffffp0" to 2.  The correct   
|   result is   0x1.fffffffffffffp0.
| 
| - When FLT_ROUNDS is 3, strtopx() converts the string
|   "1.999999999999999999999999999999999" to 2.  Strtod(),
|   on the other hand, correctly rounds down.
| 
| - When FLT_ROUNDS is 2 (round upward), strtod() converts
|   the string "0x1.23p-5000" to 0.  The correct result
|   when rounding upwards is the smallest representable
|   number, 0x1p-1074.


More information about the freebsd-standards mailing list