6 ms·
The article discusses how that turns into an infinite loop and causes a hang. When you subtract a small float from a very large float, the value doesn't change
by auxiliarymoose 1y ago
The article discusses how that turns into an infinite loop and causes a hang.
When you subtract a small float from a very large float, the value doesn't change. This is because the "steps" between float values increase with the size of the value (i.e. floats have coarser resolution for larger magnitudes)
To see this in action, try running the following in a JavaScript interpreter:
console.log(1_000_000_000_000_000_000 - 1);
- MBCook 1y agoBut that’s “impossible”. It’s an angle between 0 and 2pi. When transformed it might go over a bit so they added the check. It will “never” become big. So why check? It’s unnecessary. Thus the bug.