diff --git a/README.md b/README.md index b4e8d399..d0475ebc 100644 --- a/README.md +++ b/README.md @@ -32,15 +32,15 @@ A fast JSON parser and Object marshaller as a Ruby gem. ## Release Notes -### Release 2.0.10 +### Release 2.0.11 - - Tweaked dump calls by reducing preallocation. Speeds are now several times faster for smaller objects. + - Fixed mimic issue with Debian - - Fixed Windows compile error with Ruby 2.0.0. + - Added option to not cache classes when loading. This should be used when classes are dynamically unloaded and the redefined. -### Release 2.0.9 + - Float rounding improved by limiting decimal places to 15 places. - - Fixed problem with INFINITY with CentOS and Ruby 2.0.0. There are some header file conflicts so a different INFINITY was used. + - Fixed xml time dumping test. ## Description diff --git a/ext/oj/dump.c b/ext/oj/dump.c index 5e9f28fd..4052f5e7 100644 --- a/ext/oj/dump.c +++ b/ext/oj/dump.c @@ -429,7 +429,7 @@ dump_float(VALUE obj, Out out) { } else if (d == (double)(long long int)d) { cnt = sprintf(buf, "%.1f", d); // used sprintf due to bug in snprintf } else { - cnt = sprintf(buf, "%0.16g", d); // used sprintf due to bug in snprintf + cnt = sprintf(buf, "%0.15g", d); // used sprintf due to bug in snprintf } if (out->end - out->cur <= (long)cnt) { grow(out, cnt); diff --git a/lib/oj/version.rb b/lib/oj/version.rb index d4086250..38f64d8d 100644 --- a/lib/oj/version.rb +++ b/lib/oj/version.rb @@ -1,5 +1,5 @@ module Oj # Current version of the module. - VERSION = '2.0.10' + VERSION = '2.0.11' end diff --git a/notes b/notes index a87b4c0c..099bb03d 100644 --- a/notes +++ b/notes @@ -3,11 +3,6 @@ ^c^d hide subtree ^c^s show subtree -+ fixed mimic issue with debian -+ add option to avoid class caching -- can dump be smarter about floats -- print for time when zulu - --------------------------- Tried a separate thread for the parser and the results were poor. The parsing is 10% to 15% of the total so splitting diff --git a/test/tests.rb b/test/tests.rb index e65b358a..d5dde818 100755 --- a/test/tests.rb +++ b/test/tests.rb @@ -183,6 +183,7 @@ def test_fixnum def test_float dump_and_load(0.0, false) dump_and_load(12345.6789, false) + dump_and_load(70.35, false) dump_and_load(-54321.012, false) dump_and_load(2.48e16, false) dump_and_load(2.48e100 * 1.0e10, false) @@ -363,7 +364,7 @@ def test_xml_time_compat_precision_round begin t = Time.new(2012, 1, 5, 23, 58, 7.9996, 32400) json = Oj.dump(t, :mode => :compat, :time_format => :xmlschema, :second_precision => 3) - assert_equal(%{"2012-01-05T23:58:08.000+09:00"}, json) + assert_equal(%{"2012-01-05T23:58:08+09:00"}, json) rescue Exception # some Rubies (1.8.7) do not allow the timezome to be set t = Time.local(2012, 1, 5, 23, 58, 7, 999600)