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
fuzzy_eq() is well working with small float numbers but when the number become too large that even the round-off error exceed the epsilon(default is 1e-6), the function can return an unexpected result.
See this https://gist.github.com/ILyoan/5136141 fuzzy_eq() in 21th line will return false because
27272727272727276822 = 1e20 * (1/11) * 3
27272727272727272406 = 1e20 * (3/11)
and the difference between two numbers is larger than default epsilon
fuzzy_eq()
is well working with small float numbers but when the number become too large that even the round-off error exceed the epsilon(default is 1e-6), the function can return an unexpected result.See this
https://gist.github.com/ILyoan/5136141
fuzzy_eq()
in 21th line will returnfalse
because27272727272727276822 = 1e20 * (1/11) * 3
27272727272727272406 = 1e20 * (3/11)
and the difference between two numbers is larger than default epsilon
How about we use relative error method like this
https://gist.github.com/ILyoan/5136153
The text was updated successfully, but these errors were encountered: