diff --git a/include/Helpers/FixedPoint.hpp b/include/Helpers/FixedPoint.hpp index d1b63d1..c69c210 100644 --- a/include/Helpers/FixedPoint.hpp +++ b/include/Helpers/FixedPoint.hpp @@ -399,14 +399,14 @@ namespace FixedPoint { } explicit operator float() const { - if(isReciprocal) + if(isReciprocal && val != UnderlyingNumber(0)) return 1.0f / static_cast(val); else return static_cast(val); } explicit operator double() const { - if(isReciprocal) + if(isReciprocal && val != UnderlyingNumber(0)) return 1.0 / static_cast(val); else return static_cast(val); @@ -427,7 +427,7 @@ namespace FixedPoint { } explicit operator UnderlyingNumber() const { - if(isReciprocal) + if(isReciprocal && val != UnderlyingNumber(0)) return UnderlyingNumber(1) / val; else return val;