Skip to content

Commit c20baca

Browse files
committed
Revert "Verifying that auto comparisons aren't using float casting"
This reverts commit 2cac79a.
1 parent 2cac79a commit c20baca

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

sxpsxfp/include/sxpsxfp/Fixed.hpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
#include <sys/types.h>
2424
#endif
2525

26-
#include <limits>
27-
2826
namespace com::saxbophone::sxpsxfp {
2927
class Fixed; // forward-declaration to allow declaration of user-defined literals
3028

@@ -134,8 +132,7 @@ namespace com::saxbophone::sxpsxfp {
134132
* floating point support, so slow software floats will be used.
135133
*/
136134
explicit constexpr operator double() const {
137-
// return (double)this->_raw_value / Fixed::SCALE;
138-
return std::numeric_limits<double>::quiet_NaN(); // NaN doesn't compare equal to itself
135+
return (double)this->_raw_value / Fixed::SCALE;
139136
}
140137
/**
141138
* @brief Explicit cast operator to float
@@ -150,8 +147,7 @@ namespace com::saxbophone::sxpsxfp {
150147
*/
151148
explicit constexpr operator float() const {
152149
// reuse cast to double and then narrow it to float
153-
// return (float)(double)*this;
154-
return std::numeric_limits<float>::quiet_NaN(); // NaN doesn't compare equal to itself
150+
return (float)(double)*this;
155151
}
156152
/**
157153
* @returns Fixed-point value converted to integer, with fractional part truncated.

0 commit comments

Comments
 (0)