You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Stratego is weird. Equality between two Real terms (double precision floating point numbers) is done with Java's built-in == operator, despite how common wisdom for comparing floats goes by comparing if their difference in under a certain threshold. TermUtils uses a fuzzy equals that uses difference under a threshold of 1e-30. I think to avoid more confusion, it should instead use the equality that Stratego uses for terms everywhere else. Thoughts?
If the rest of Stratego uses == for floating-point equality, then that should be changed. In practice, two floating points are rarely exactly equal, so matching will almost always fail.
Ok, can you change it then @Virtlink? I know it's a silly way to do comparisons this way, but there is not much use of floating points in Stratego anyway.
Perhaps we can add a strategy to the standard library of Stratego for proper comparison of reals like real-diff-within(|real) :: (real, real) -> (real, real) where you provide the epsilon value yourself. But that's separate from this issue.
Stratego is weird. Equality between two Real terms (double precision floating point numbers) is done with Java's built-in
==
operator, despite how common wisdom for comparing floats goes by comparing if their difference in under a certain threshold.TermUtils
uses a fuzzy equals that uses difference under a threshold of1e-30
. I think to avoid more confusion, it should instead use the equality that Stratego uses for terms everywhere else. Thoughts?mb-rep/org.spoofax.terms/src/org/spoofax/terms/util/TermUtils.java
Line 96 in 0168416
The text was updated successfully, but these errors were encountered: