diff --git a/HandmadeMath.h b/HandmadeMath.h index 9a5ec40..ad54aa8 100644 --- a/HandmadeMath.h +++ b/HandmadeMath.h @@ -680,14 +680,7 @@ HMM_Power(float Base, int Exponent) HINLINE float HMM_PowerF(float Base, float Exponent) { - if (Base > 0) - { - return expf(Exponent * logf(Base)); - } - else - { - return -expf(Exponent * logf(-Base)); - } + return expf(Exponent * logf(Base)); } HINLINE float diff --git a/test/hmm_test.cpp b/test/hmm_test.cpp index e94f624..a14fb2b 100644 --- a/test/hmm_test.cpp +++ b/test/hmm_test.cpp @@ -61,9 +61,7 @@ TEST(ScalarMath, PowerF) { EXPECT_FLOAT_EQ(HMM_PowerF(2.0f, 0), 1.0f); EXPECT_NEAR(HMM_PowerF(2.0f, 4.1), 17.148376f, 0.0001f); - EXPECT_NEAR(HMM_PowerF(-2.0f, 4.1), -17.148376f, 0.0001f); EXPECT_NEAR(HMM_PowerF(2.0f, -2.5), 0.176777f, 0.0001f); - EXPECT_NEAR(HMM_PowerF(-2.0f, -2.5), -0.176777f, 0.0001f); } TEST(ScalarMath, Lerp)