diff options
| author | Ryan Houdek <Sonicadvance1@gmail.com> | 2015-07-01 01:09:43 -0500 |
|---|---|---|
| committer | Ryan Houdek <Sonicadvance1@gmail.com> | 2015-07-01 01:09:43 -0500 |
| commit | b174f99b171a36753b0f3c6f02fe21ab403608f2 (patch) | |
| tree | b64f6ff2be200a3ade796bf902cc8ff272de9555 /Source/Core/Common/MathUtil.cpp | |
| parent | 68d8d784eee0e18cb195fdc14683b48c4d87f9f9 (diff) | |
| parent | 2711d5201b88d47ac5b980f0d73eb0b688368f91 (diff) | |
Merge pull request #2662 from Tilka/interpreter
Interpreter: turn SNaNs into QNaNs
Diffstat (limited to 'Source/Core/Common/MathUtil.cpp')
| -rw-r--r-- | Source/Core/Common/MathUtil.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Source/Core/Common/MathUtil.cpp b/Source/Core/Common/MathUtil.cpp index 07fa5bf293..a9252ddf55 100644 --- a/Source/Core/Common/MathUtil.cpp +++ b/Source/Core/Common/MathUtil.cpp @@ -209,23 +209,23 @@ double ApproximateReciprocal(double val) // Special case 0 if (mantissa == 0 && exponent == 0) - return sign ? -std::numeric_limits<double>::infinity() : std::numeric_limits<double>::infinity(); + return std::copysign(std::numeric_limits<double>::infinity(), valf); // Special case NaN-ish numbers if (exponent == (0x7FFLL << 52)) { if (mantissa == 0) - return sign ? -0.0 : 0.0; + return std::copysign(0.0, valf); return 0.0 + valf; } // Special case small inputs if (exponent < (895LL << 52)) - return sign ? -std::numeric_limits<float>::max() : std::numeric_limits<float>::max(); + return std::copysign(std::numeric_limits<float>::max(), valf); // Special case large inputs if (exponent >= (1149LL << 52)) - return sign ? -0.0f : 0.0f; + return std::copysign(0.0, valf); exponent = (0x7FDLL << 52) - exponent; |
