Merge pull request #109 from open-source-parsers/double-string-double

Double string double
This commit is contained in:
Christopher Dunn 2015-01-06 12:54:39 -06:00
commit 6eaf150dc7
4 changed files with 10 additions and 10 deletions

View File

@ -4,9 +4,9 @@
#ifndef JSON_VERSION_H_INCLUDED
# define JSON_VERSION_H_INCLUDED
# define JSONCPP_VERSION_STRING "1.0.0"
# define JSONCPP_VERSION_STRING "1.1.0"
# define JSONCPP_VERSION_MAJOR 1
# define JSONCPP_VERSION_MINOR 0
# define JSONCPP_VERSION_MINOR 1
# define JSONCPP_VERSION_PATCH 0
# define JSONCPP_VERSION_QUALIFIER
# define JSONCPP_VERSION_HEXA ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | (JSONCPP_VERSION_PATCH << 8))

View File

@ -87,13 +87,13 @@ std::string valueToString(double value) {
// visual studio 2005 to
// avoid warning.
#if defined(WINCE)
len = _snprintf(buffer, sizeof(buffer), "%.16g", value);
len = _snprintf(buffer, sizeof(buffer), "%.17g", value);
#else
len = sprintf_s(buffer, sizeof(buffer), "%.16g", value);
len = sprintf_s(buffer, sizeof(buffer), "%.17g", value);
#endif
#else
if (isfinite(value)) {
len = snprintf(buffer, sizeof(buffer), "%.16g", value);
len = snprintf(buffer, sizeof(buffer), "%.17g", value);
} else {
// IEEE standard states that NaN values will not compare to themselves
if (value != value) {

View File

@ -926,7 +926,7 @@ JSONTEST_FIXTURE(ValueTest, integers) {
JSONTEST_ASSERT_EQUAL(float(uint64ToDouble(Json::UInt64(1) << 63)),
val.asFloat());
JSONTEST_ASSERT_EQUAL(true, val.asBool());
JSONTEST_ASSERT_STRING_EQUAL("9.223372036854776e+18",
JSONTEST_ASSERT_STRING_EQUAL("9.2233720368547758e+18",
normalizeFloatingPointStr(val.asString()));
// int64 min
@ -974,7 +974,7 @@ JSONTEST_FIXTURE(ValueTest, integers) {
JSONTEST_ASSERT_EQUAL(-9223372036854775808.0, val.asDouble());
JSONTEST_ASSERT_EQUAL(-9223372036854775808.0, val.asFloat());
JSONTEST_ASSERT_EQUAL(true, val.asBool());
JSONTEST_ASSERT_STRING_EQUAL("-9.223372036854776e+18",
JSONTEST_ASSERT_STRING_EQUAL("-9.2233720368547758e+18",
normalizeFloatingPointStr(val.asString()));
// 10^19
@ -1065,7 +1065,7 @@ JSONTEST_FIXTURE(ValueTest, integers) {
JSONTEST_ASSERT_EQUAL(18446744073709551616.0, val.asDouble());
JSONTEST_ASSERT_EQUAL(18446744073709551616.0, val.asFloat());
JSONTEST_ASSERT_EQUAL(true, val.asBool());
JSONTEST_ASSERT_STRING_EQUAL("1.844674407370955e+19",
JSONTEST_ASSERT_STRING_EQUAL("1.8446744073709552e+19",
normalizeFloatingPointStr(val.asString()));
#endif
}
@ -1217,7 +1217,7 @@ JSONTEST_FIXTURE(ValueTest, nonIntegers) {
normalizeFloatingPointStr(val.asString()));
val = Json::Value(1.2345678901234);
JSONTEST_ASSERT_STRING_EQUAL("1.2345678901234",
JSONTEST_ASSERT_STRING_EQUAL("1.2345678901234001",
normalizeFloatingPointStr(val.asString()));
// A 16-digit floating point number.

View File

@ -1 +1 @@
1.0.0
1.1.0