Skip Menu |

This queue is for tickets about the YAML-Syck CPAN distribution.

Report information
The Basics
Id: 54725
Status: resolved
Priority: 0/
Queue: YAML-Syck

People
Owner: TODDR [...] cpan.org
Requestors: pause [...] nodekit.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.07
Fixed in: (no value)



Subject: JSON floats broken by long double support
JSON::Syck does bad things to floating point values, when running on Perls which have long double as their default float type. This does not occur for YAML::Syck. I built a stand-alone copy of Perl with long double support enabled at Configure time, and have been able to reliably reproduce the problem. I've pasted a simple test script and example output, below. Thanks --Alex #### File: json-double-test use strict; use warnings; use Config; print "Arch: $Config{archname}\n"; use YAML::Syck; use JSON::Syck; my $loadedYAMLSyck = YAML::Syck::Load("---\ntestFloat: 3.14159265\n"); my $loadedJSONSyck = JSON::Syck::Load("{\"testFloat\":3.14159265}"); print "Loaded YAML (Syck) Value: ". $loadedYAMLSyck->{testFloat} ."\n"; print "Loaded JSON (Syck) Value: ". $loadedJSONSyck->{testFloat} ."\n"; __END__ Produces the following output for me: # ~/ldperl/bin/perl json-double-test Arch: x86_64-linux-ld Loaded YAML (Syck) Value: 3.14159265 Loaded JSON (Syck) Value: 3.14159265000000021 # perl json-double-test Arch: x86_64-linux Loaded YAML (Syck) Value: 3.14159265 Loaded JSON (Syck) Value: 3.14159265
(This is a form-reply that isn't specific to your particular report) YAML::Syck has just acquired one new maintainer (me), it still doesn't have anyone that *cares* about it. But I'm willing to help solve your report & release a new version with the fix if it's easy for me. It now has a Git repository at: http://github.com/avar/YAML-Syck If your report is a patch that fixes a problem, great. Please remake the patch against Git by forking that repo and sending me a pull request on GitHub (or an update to this bug if you prefer git-format-patch(1) or some other repo provider..). Make sure to include a test for what you fixed. If your report is some code that fails (and you have a testcase for it) a patch against the test suite to demonstrate that failure would be very useful. It's OK if the test crashes and burns, see Test::More's docs for how to make TODO tests that fail now, but shouldn't. Even if it segfaults perl C<system $^X => qw/ -Mblib -MYAML::Syck .../> or something like that and checking the return value will do.
This should be fixed in 1.10_02. All floats will be quoted to fix round trip issues. Please let us know if this is not the case.