Commit dfba62e1 authored by Milo Yip's avatar Milo Yip

Fixed two -Wfloat-equal warnings

parent 53ed550a
...@@ -238,7 +238,7 @@ inline DiyFp GetCachedPower(int e, int* K) { ...@@ -238,7 +238,7 @@ inline DiyFp GetCachedPower(int e, int* K) {
//int k = static_cast<int>(ceil((-61 - e) * 0.30102999566398114)) + 374; //int k = static_cast<int>(ceil((-61 - e) * 0.30102999566398114)) + 374;
double dk = (-61 - e) * 0.30102999566398114 + 347; // dk must be positive, so can do ceiling in positive double dk = (-61 - e) * 0.30102999566398114 + 347; // dk must be positive, so can do ceiling in positive
int k = static_cast<int>(dk); int k = static_cast<int>(dk);
if (k != dk) if (dk - k > 0.0)
k++; k++;
unsigned index = static_cast<unsigned>((k >> 3) + 1); unsigned index = static_cast<unsigned>((k >> 3) + 1);
......
...@@ -193,8 +193,8 @@ inline char* Prettify(char* buffer, int length, int k) { ...@@ -193,8 +193,8 @@ inline char* Prettify(char* buffer, int length, int k) {
} }
inline char* dtoa(double value, char* buffer) { inline char* dtoa(double value, char* buffer) {
if (value == 0) { Double d(value);
Double d(value); if (d.IsZero()) {
if (d.Sign()) if (d.Sign())
*buffer++ = '-'; // -0.0, Issue #289 *buffer++ = '-'; // -0.0, Issue #289
buffer[0] = '0'; buffer[0] = '0';
......
...@@ -49,6 +49,7 @@ public: ...@@ -49,6 +49,7 @@ public:
bool IsNan() const { return (u & kExponentMask) == kExponentMask && Significand() != 0; } bool IsNan() const { return (u & kExponentMask) == kExponentMask && Significand() != 0; }
bool IsInf() const { return (u & kExponentMask) == kExponentMask && Significand() == 0; } bool IsInf() const { return (u & kExponentMask) == kExponentMask && Significand() == 0; }
bool IsNormal() const { return (u & kExponentMask) != 0 || Significand() == 0; } bool IsNormal() const { return (u & kExponentMask) != 0 || Significand() == 0; }
bool IsZero() const { return (u & (kExponentMask | kSignificandMask)) == 0; }
uint64_t IntegerSignificand() const { return IsNormal() ? Significand() | kHiddenBit : Significand(); } uint64_t IntegerSignificand() const { return IsNormal() ? Significand() | kHiddenBit : Significand(); }
int IntegerExponent() const { return (IsNormal() ? Exponent() : kDenormalExponent) - kSignificandSize; } int IntegerExponent() const { return (IsNormal() ? Exponent() : kDenormalExponent) - kSignificandSize; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment