Skip to content

Commit

Permalink
Cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
bkaradzic committed Dec 8, 2024
1 parent 1faeaee commit f259338
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions include/bx/inline/math.inl
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,16 @@ namespace bx

inline BX_CONSTEXPR_FUNC float log(float _a)
{
if (_a < 0.0f)
{
return bitsToFloat(kFloatSignMask | kFloatExponentMask | kFloatMantissaMask);
}

if (_a == 0.0f)
{
return -kFloatInfinity;
}

const uint32_t ftob = floatToBits(_a);

const uint32_t masked0 = uint32_and(ftob, kFloatExponentMask);
Expand Down Expand Up @@ -465,6 +475,11 @@ namespace bx
return 0.0f;
}

if (isInfinite(_a) && _a < 0.0f)
{
return 0.0f;
}

constexpr float kExpC0 = 1.66666666666666019037e-01f;
constexpr float kExpC1 = -2.77777777770155933842e-03f;
constexpr float kExpC2 = 6.61375632143793436117e-05f;
Expand Down

0 comments on commit f259338

Please sign in to comment.