Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> You can read the standard here: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf

That's not the current version of C. The best document right now is https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3220.pdf (which is C23 with one or two editorial fixes).

Note that Annex §F.3¶20 says

> However, correct rounding, which ISO/IEC 60559 specifies for its operations, is not required for the C functions in the table.

which proceeds to list most of the functions in IEEE 754-2008/2019 section 9.2.

A C compiler which claims conformance to IEEE 754 need not correctly round those functions. Most C libraries do not correctly round all of these functions: https://members.loria.fr/PZimmermann/papers/accuracy.pdf

(in summary, llvm-libc correctly rounds all functions, as it's explicitly borrowing from one of the correctly-rounded efforts; of the other implementations, Intel's library usually gets the closest, but not always).



well Intel gets closest if you ignore subnormals which by default truncate to 0 for infinite relative error


The math library will happily give you good subnormal results if you compile your program without turning on DAZ/FTZ.

(Insert long rant about icc enabling daz/ftz by default.)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: