Very small negative floating point values compare as equal to zero, instead of less than zero.
This bug is a regression from MSWLogo that first appeared in FMSLogo 6.7.2 as a misguided fix for bug #1397519, which includes problems like the following mathematical expression being false.
2 = POWER SQRT 2 2
The root cause of this bug is that I added some smoothing code for floating point comparisons that treats any two floating point values within a DBL_EPSILON of each other as equal. Since the gains of my epsilon-aware logic are dubious but the cost is very real in terms of broken lesson plans, I will revert my change and back to the MSWLogo behavior.
How Reproducible:
Every Time
Steps to Reproduce:
SHOW -1e-16 < 0
What Happens:
false
Expected Result:
true
This bug was reported by Daniel Ajoy in a private email.
Logged In: YES
user_id=109252
Originator: YES
I have submitted a fix for this. It will be available in FMSLogo 6.14.0. I have also added regression tests.
After fixing this bug, many of the math tests which had previously passed now fail. These are mostly like the "2 = POWER SQRT 2 2" above--they do things with irrational numbers that, mathematically, should be equal, but due to precision errors, they are slightly different. Many of these are so close that they even print out as the same value, even though they compare as different values.