Fix sign(NAN) returning 1.

Fixes #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.
This commit is contained in:
AcatXIo 2023-09-09 11:30:11 +02:00
parent 8c1817f755
commit 7d69a5ba50
3 changed files with 8 additions and 3 deletions

View file

@ -54,6 +54,8 @@ TEST_CASE("[Math] C++ macros") {
CHECK(SIGN(-5) == -1.0);
CHECK(SIGN(0) == 0.0);
CHECK(SIGN(5) == 1.0);
// Check that SIGN(NAN) returns 0.0.
CHECK(SIGN(NAN) == 0.0);
}
TEST_CASE("[Math] Power of two functions") {