Fixed atan2.

This commit is contained in:
Branimir Karadžić
2018-04-23 16:22:14 -07:00
parent 2dc2137905
commit 7a05d19352
2 changed files with 8 additions and 0 deletions

View File

@@ -124,6 +124,12 @@ namespace bx
const float ay = abs(_y);
const float maxaxy = max(ax, ay);
const float minaxy = min(ax, ay);
if (maxaxy == 0.0f)
{
return 0.0f*sign(_y);
}
const float mxy = minaxy / maxaxy;
const float mxysq = square(mxy);
const float tmp0 = mad(kAtan2C0, mxysq, kAtan2C1);

View File

@@ -144,6 +144,8 @@ TEST_CASE("libm", "")
REQUIRE(bx::equal(bx::atan2(yy, xx), ::atan2f(yy, xx), 0.00001f) );
}
}
REQUIRE(bx::equal(bx::atan2(0.0f, 0.0f), ::atan2f(0.0f, 0.0f), 0.00001f) );
}
TEST_CASE("ToBits", "")