Example IsApproximatelyEqual
has a bug when using negative numbers
#9173
Labels
area-System.Runtime
help wanted
Good for community contributors to help [up-for-grabs]
Pri3
Indicates issues/PRs that are low priority
Milestone
The example code for
IsApproximatelyEqual
in single fails when you pass it negative numbers.For example:
returns
True
This seems to be caused by the
divisor
being negative:Given two negative numbers the divisor is negative and so always
<= epsilon
. Testing locally a fix is toMath.Abs(divisor)
or change the return line to:The text was updated successfully, but these errors were encountered: