summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/video_core/pica_types.h18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/video_core/pica_types.h b/src/video_core/pica_types.h
index 5d7e10066..2eafa7e9e 100644
--- a/src/video_core/pica_types.h
+++ b/src/video_core/pica_types.h
@@ -58,11 +58,12 @@ public:
58 } 58 }
59 59
60 Float<M, E> operator*(const Float<M, E>& flt) const { 60 Float<M, E> operator*(const Float<M, E>& flt) const {
61 if ((this->value == 0.f && !std::isnan(flt.value)) || 61 float result = value * flt.ToFloat32();
62 (flt.value == 0.f && !std::isnan(this->value))) 62 // PICA gives 0 instead of NaN when multiplying by inf
63 // PICA gives 0 instead of NaN when multiplying by inf 63 if (!std::isnan(value) && !std::isnan(flt.ToFloat32()))
64 return Zero(); 64 if (std::isnan(result))
65 return Float<M, E>::FromFloat32(ToFloat32() * flt.ToFloat32()); 65 result = 0.f;
66 return Float<M, E>::FromFloat32(result);
66 } 67 }
67 68
68 Float<M, E> operator/(const Float<M, E>& flt) const { 69 Float<M, E> operator/(const Float<M, E>& flt) const {
@@ -78,12 +79,7 @@ public:
78 } 79 }
79 80
80 Float<M, E>& operator*=(const Float<M, E>& flt) { 81 Float<M, E>& operator*=(const Float<M, E>& flt) {
81 if ((this->value == 0.f && !std::isnan(flt.value)) || 82 value = operator*(flt).value;
82 (flt.value == 0.f && !std::isnan(this->value)))
83 // PICA gives 0 instead of NaN when multiplying by inf
84 *this = Zero();
85 else
86 value *= flt.ToFloat32();
87 return *this; 83 return *this;
88 } 84 }
89 85