logoalt Hacker News

shaknatoday at 5:09 AM1 replyview on HN

Okay, as the last wasn't obvious enough: C does not do IEEE 754 math.

It is _all_ non-IEEE 754 math.

That it isn't compliant is a compiler guarantee, in the current state of things.

You may as well have an `assert(1)`.


Replies

eesmithtoday at 6:37 AM

And as I wrote, "There's platform and there's platform."

I don't support the full range of platforms that C supports. I assume 8 bit chars. I assume good hardware support for 754. I assume the compiler's documentation is correct when it says it map "double" to "binary64" and uses native operations. I assume if someone else compiles my code with non-754 flags, like fused multiply and add, then it's not a problem I need to worry about.

For that matter, my code doesn't deal with NaNs or inf (other than input rejection tests) so I don't even need fully conformant 754.

show 2 replies