Correct the Value::operator==() for double.

This commit is contained in:
miloyip 2015-04-11 11:34:44 +08:00
parent 55f8339a0a
commit cb59a5a9a2

View File

@ -701,8 +701,9 @@ public:
case kNumberType:
if (IsDouble() || rhs.IsDouble()) {
float delta = GetDouble() - rhs.GetDouble(); // May convert one operand from integer to double.
return delta >= 0.0 && delta <= 0.0; // Prevent -Wfloat-equal
double a = GetDouble(); // May convert from integer to double.
double b = rhs.GetDouble(); // Ditto
return a >= b && a <= b; // Prevent -Wfloat-equal
}
else
return data_.n.u64 == rhs.data_.n.u64;