-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sign
returns 1
for NAN
#79036
Comments
Lines 110 to 113 in cdd2313
godot/core/variant/variant_utility.cpp Lines 243 to 275 in cdd2313
godot/core/variant/variant_utility.cpp Lines 277 to 283 in cdd2313
I'm not sure what behavior should be, it's probably implemented this way for performance. But perhaps we could add checks to the For comparison, in JavaScript: Math.sign(NaN) // NaN |
Fixes godotengine#79036. sign(NAN) now returns 0. This should not impact performance much in any way. Adds a test for the NAN case. Updates the documentation to clarify the new behavior.
Godot version
4.1.rc3
System information
Linux 5.10.181-2-MANJARO
Issue description
sign(NAN)
andsignf(NAN)
both return1
. But this doesn't seem right, asNAN > 0
is false (as all otherNAN
comparison are). These should really returnNAN
not1
.Steps to reproduce
run
output is:
1 1
Minimal reproduction project
N/A
The text was updated successfully, but these errors were encountered: