Skip to content

Commit

Permalink
Merge pull request #109 from open-source-parsers/double-string-double
Browse files Browse the repository at this point in the history
Double string double
  • Loading branch information
cdunn2001 committed Jan 6, 2015
2 parents dfc5f87 + 8b489f8 commit 6eaf150
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions include/json/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
6 changes: 3 additions & 3 deletions src/lib_json/json_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
8 changes: 4 additions & 4 deletions src/test_lib_json/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.0
1.1.0

0 comments on commit 6eaf150

Please sign in to comment.