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
In order to compare calculation results to NaN, at least the math32.Ray does the following, e.g. in func(*Ray) IntersectPlane(...)
t := ray.DistanceToPlane(plane)
if t == NaN() {
return nil
}
Bug:
Comparing NaNs by value does not work. Those NaNs are IEEE 754 NaNs afaik, meaning the exponent bits are all 1 and the mantissa bits are non-zero. So, comparing by value might work (same mantissa) but it would be a rare exception.
You may try math32.NaN() == math32.NaN() if you like, or math.Log(-1.0) == math.Log(-1.0). Playground
Possible solution:
NaN-checks in golang can use the math.IsNaN(float64) function.
It is possible to extend the math32 by
Description:
In order to compare calculation results to NaN, at least the math32.Ray does the following, e.g. in func(*Ray) IntersectPlane(...)
Bug:
Comparing NaNs by value does not work. Those NaNs are IEEE 754 NaNs afaik, meaning the exponent bits are all 1 and the mantissa bits are non-zero. So, comparing by value might work (same mantissa) but it would be a rare exception.
You may try math32.NaN() == math32.NaN() if you like, or math.Log(-1.0) == math.Log(-1.0).
Playground
Possible solution:
NaN-checks in golang can use the math.IsNaN(float64) function.
It is possible to extend the math32 by
This func should be used everywhere a check against NaN has to be performed.
A quick search for
== NaN()
and== math32.NaN()
only returned the code in Ray.IntersectPlane, so maybe this bug does not hurt that much.Edit:
As math32 already has such a IsNaN() function, it only has to be used.
The text was updated successfully, but these errors were encountered: