4 ms·
Never perform equality tests on FP numbers period - it defeats the purpose of using floating point. This is not specific to the IEEE format.
by a1369209993 6y ago
Never perform equality tests on FP numbers period - it defeats the purpose of using floating point. This is not specific to the IEEE format.
- imtringued 6y agoTell that to lua and javascript developers who only have access to FP numbers.
- a1369209993 6y agoshrug They also only have access to IEEE FP numbers, so that applies equally much to the parent.
- astrobe_ 6y agoIf my memory serves, IEEE FP is accurate for those real numbers that are also integers (at least on some range). JS users are safe as long as they stay within the integer algebra (ie they don't use division, mainly, or perhaps round up the result). Lua users have the extra option to recompile their interpreter it uses integers.
- a1369209993 6y agoThat's fair as far as it goes (I pedantically should have said general-purpose FP numbers), but, again, applies equally well (actually more so, since they were talking about IEEE FP specifically) to the parent post.