From b78310bbe562ee1c133d06739cf5a16167f10145 Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Thu, 25 Jun 2015 22:29:31 +0200 Subject: [PATCH] Interpreter: simplify fres --- Source/Core/Common/MathUtil.cpp | 8 ++++---- 1 file 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::infinity() : std::numeric_limits::infinity(); + return std::copysign(std::numeric_limits::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::max() : std::numeric_limits::max(); + return std::copysign(std::numeric_limits::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;