4 ms·
For example, floating point without can represent two numbers whose difference is smaller than the number can represent and rounds to zero. Subnormal floating p
by duped 2y ago
For example, floating point without can represent two numbers whose difference is smaller than the number can represent and rounds to zero. Subnormal floating point doesn't fix this, it just moves the impacts of underflow to smaller magnitudes that are less likely to be seen.
Look, -ffast-math isn't always fine, but specifically I'm looking at DAZ/FTZ enabled, possibly non-deterministically process-wide (which is bad, don't get me wrong!). But part of why this doesn't phase people is because in practice, programs don't care and the observable effects don't lead to bugs.
- mbauman 2y ago> floating point without can represent two numbers whose difference is smaller than the number can represent and rounds to zero Did you intend to say "without FTZ/DAZ enabled"? If so, that's completely and provenly false. https://en.wikipedia.org/wiki/Sterbenz_lemma https://en.wikipedia.org/wiki/Sterbenz_lemma Perhaps a better example than `z/(x-y)` is `log(x-y)`. Unlike division by 0.0, `log(0.0)` often throws an immediate error whereas `log(5e-324)` is a finite — and meaningful! — result.