3 ms·
Well, you shouldn't do exact equality check on floats anyway, that can be a source of fun bugs regardless of rounding.
by deepsun 5y ago
Well, you shouldn't do exact equality check on floats anyway, that can be a source of fun bugs regardless of rounding.
- gugagore 5y agoI see this advice often and I find that it misses the point. The problem isn't the equality check, the problem is finite precision. There are situations that call for exact equality checking in floating point.
- cratermoon 5y agoIn which case, you don't use IEEE 754 floating point for math, you use some kind of numerics type or library that correctly models the domain.