Hacker News new | ask | show | jobs
by mgaunard 1356 days ago
I gave conditions upon which testing for equality is correct.

Of course if the result is non-deterministic it doesn't satisfy those conditions.

1 comments

Unfortunately it may be quite hard to certify that your program qualifies, specially if it's a high performance program that can't be single threaded. An innocuous-looking commit can completely undermine this property.

Doubly so if you must guarantee determinism across multiple platforms! IEEE 754-2008 helps but it defines cross-platform determinism for just a subset of operations. Compilers can also sometimes botch your FP code (there's a number of gotchas - for example, if any library anywhere in your program uses -ffast-math, it may infect the whole program https://stackoverflow.com/questions/68938175/what-happens-if...)

Achieving exact or correctly-rounded results is much more work than that.

You can look at the crlibm papers for example.