Skip Menu |

This queue is for tickets about the JSON-PP CPAN distribution.

Report information
The Basics
Id: 128589
Status: resolved
Priority: 0/
Queue: JSON-PP

People
Owner: Nobody in particular
Requestors: davem [...] iabyn.com
Cc:
AdminCc:

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



Subject: t/011_pc_expo.t fails with long doubles
Date: Fri, 22 Feb 2019 13:07:54 +0000
To: bug-JSON-PP [...] rt.cpan.org
From: Dave Mitchell <davem [...] iabyn.com>
On bleadperl built with -Duselongdouble or -Dquadmath, the JSON::PP test script t/011_pc_expo.t fails test 8 because it expects the equivalent of this stringification my $n = 1.01e+30; my $s = "$n" to yield "1.01e+30" or "1.01e+030", whereas under -Dquadmath at least, it's yielding "1010000000000000000000000000000". I don't think that's a fault with perl's stringification (although I couldn't find any perl docs which explain what promises, if any, we make when stringifying a float), so I assume either the test needs updating or JSON::PP needs fixing depending on what it's supposed to yield for a floating value. -- The Enterprise is captured by a vastly superior alien intelligence which does not put them on trial. -- Things That Never Happen in "Star Trek" #10
On Fri Feb 22 22:08:05 2019, davem@iabyn.com wrote: Show quoted text
> On bleadperl built with -Duselongdouble or -Dquadmath, the JSON::PP test > script t/011_pc_expo.t fails test 8 because it expects the equivalent of > this stringification > > my $n = 1.01e+30; > my $s = "$n" > > to yield "1.01e+30" or "1.01e+030", whereas under -Dquadmath at least, > it's yielding "1010000000000000000000000000000". > > I don't think that's a fault with perl's stringification (although I > couldn't find any perl docs which explain what promises, if any, we make > when stringifying a float), so I assume either the test needs updating or > JSON::PP needs fixing depending on what it's supposed to yield for a > floating value. > > >
Thanks for the report. I assume the following patch should fix the issue but I don't have an environment to make the test actually fail, so could you please help me if you have one? The test itself is for backward compatibility with an ancient module that's long forgottten, so we can change it where necessary. --- a/t/011_pc_expo.t +++ b/t/011_pc_expo.t @@ -37,7 +37,7 @@ $js = q|[1.01e+30]|; $obj = $pc->decode($js); is($obj->[0], 1.01e+30, 'digit 1.01e+30'); $js = $pc->encode($obj); -like($js,qr/\[1.01[Ee]\+0?30\]/, 'digit 1.01e+30'); +like($js,qr/\[(?:1.01[Ee]\+0?30|1010000000000000000000000000000)]/, 'digit 1.01e+30'); # RT-128589 my $vax_float = (pack("d",1) =~ /^[\x80\x10]\x40/);
Subject: Re: [rt.cpan.org #128589] t/011_pc_expo.t fails with long doubles
Date: Fri, 22 Feb 2019 17:09:54 +0000
To: Kenichi Ishigaki via RT <bug-JSON-PP [...] rt.cpan.org>
From: Dave Mitchell <davem [...] iabyn.com>
The patch fixes the issue on -Dquadmaths perl builds, thanks. It wasn't failing for me on -Duselongdouble builds, so I can't confirm whether that's fixed (I've only seen it fail on other people's perl smokes), but I'm assuming its likely to be the same cause with the same fix. -- You never really learn to swear until you learn to drive.
On Sat Feb 23 02:10:03 2019, davem@iabyn.com wrote: Show quoted text
> The patch fixes the issue on -Dquadmaths perl builds, thanks. > > It wasn't failing for me on -Duselongdouble builds, so I can't confirm > whether that's fixed (I've only seen it fail on other people's perl > smokes), but I'm assuming its likely to be the same cause with the same > fix. >
Shipped 4.02 with the fix. If it breaks on -Duselongdouble builds, please reopen this. Thanks.