Fix round towards even

This commit is contained in:
miloyip 2014-09-15 16:53:57 +08:00
parent b29acfb90d
commit 50fc3fedb2

View File

@ -477,7 +477,7 @@ inline double FullPrecision(double d, int p, const char* decimals, size_t length
else if (cmp == 0) { else if (cmp == 0) {
// Round towards even // Round towards even
if (approx.Significand() & 1) if (approx.Significand() & 1)
return approx.NextDouble(); return adjustToNegative ? approx.PreviousDouble() : approx.NextDouble();
else else
return approx.Value(); return approx.Value();
} }