From 50fc3fedb2e09445f5214432387767c84e562805 Mon Sep 17 00:00:00 2001 From: miloyip Date: Mon, 15 Sep 2014 16:53:57 +0800 Subject: [PATCH] Fix round towards even --- include/rapidjson/internal/strtod.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/rapidjson/internal/strtod.h b/include/rapidjson/internal/strtod.h index 939cadb..9c4b20d 100644 --- a/include/rapidjson/internal/strtod.h +++ b/include/rapidjson/internal/strtod.h @@ -477,7 +477,7 @@ inline double FullPrecision(double d, int p, const char* decimals, size_t length else if (cmp == 0) { // Round towards even if (approx.Significand() & 1) - return approx.NextDouble(); + return adjustToNegative ? approx.PreviousDouble() : approx.NextDouble(); else return approx.Value(); }