diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_FPUtils.h b/Source/Core/Core/PowerPC/Interpreter/Interpreter_FPUtils.h index 5a583b7892..7273b62e7f 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_FPUtils.h +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_FPUtils.h @@ -165,16 +165,22 @@ inline double NI_add(double a, double b) inline double NI_sub(double a, double b) { - double t = a - b; + const double t = a - b; + if (std::isnan(t)) { + if (Common::IsSNAN(a) || Common::IsSNAN(b)) + SetFPException(FPSCR_VXSNAN); + if (std::isnan(a)) return MakeQuiet(a); if (std::isnan(b)) return MakeQuiet(b); + SetFPException(FPSCR_VXISI); return PPC_NAN; } + return t; }