Skip Menu |

This queue is for tickets about the Math-NumSeq CPAN distribution.

Report information
The Basics
Id: 92528
Status: resolved
Priority: 0/
Queue: Math-NumSeq

People
Owner: Nobody in particular
Requestors: ANDK [...] cpan.org
Cc:
AdminCc:

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



Subject: Fails on nvsize!=8
As per subject. Compiling with -Duselongdouble on a 64 bit system should trigger that. Sample fail report: http://www.cpantesters.org/cpan/report/38972369 Let me know if you need further details HTH && Thanks, (Disclaimer: this was discovered by statistical analysis, I'm not speaking as a user)
Replicated with perl 5.19.7 built with long double. In t/Fibonacci.t I inserted before the i+3 case: if ($i == 100) { print "i = $i got_i = $i\n"; printf "%.20f\n%20f\n", $got_value, $seq->ith($i+3); } if ($i == 100) { print unpack("h*", pack("F", $got_value)), "\n"; print unpack("h*", pack("F", $seq->ith($i+3))), "\n"; } and got: i = 100 got_i = 100 1500520536206896083200.00000000000000000000 1500520536206896083328.000000 26a6dc92bafcfa2a5404000000000000 36a6dc92bafcfa2a5404000000000000 showing the FP representations differ. If I change the loop for use $j, then do: my $i = Math::BigInt->new($j); at the top, then both calls return 1500520536206896083277 which is the correct value for F_103. At first blush, perhaps the comparison should be inexact (e.g. Test::Number::Delta or equivalent) or Math::BigInts should be used.
CC: ANDK [...] cpan.org, bug-Math-NumSeq [...] rt.cpan.org
Subject: Re: [rt.cpan.org #92528] Fails on nvsize!=8
Date: Sat, 01 Feb 2014 11:59:03 +1100
To: dana.jacobsen [...] gmail.com
From: Kevin Ryde <user42 [...] zip.com.au>
"Dana Jacobsen via RT" <bug-Math-NumSeq@rt.cpan.org> writes: Show quoted text
> > 1500520536206896083200.00000000000000000000 > 1500520536206896083328.000000
Thanks. I suspect my test for the limit of nv precision is not quite right, or rather that in the ith() code I go a few bits past the final return value being calculated and therefore have to promote to bigint sooner.
RT-Send-CC: dana.jacobsen [...] gmail.com
An outright bug in the automatic bigint-ification part of the ith() code. Version 69 should be better.
On Sat Feb 15 19:48:45 2014, KRYDE wrote: Show quoted text
> An outright bug in the automatic bigint-ification part of the ith() > code. Version 69 should be better.
Verified fixed on system with long double. perl -MMath::GMPz -E 'my $r = Math::GMPz->new(0); do { Math::GMPz::Rmpz_fib_ui($r,$_); say $r; } for 0..1000' | md5sum 965b3e3787b56f2147843171366e835b - v68: perl -MMath::NumSeq::Fibonacci -E 'my $seq = Math::NumSeq::Fibonacci->new(); do { $seq->seek_to_i($_); say 0+($seq->next)[1] } for 0..1000;' | md5sum d63da6d1459f9812cf367ddb90ebfc45 - v69: perl -MMath::NumSeq::Fibonacci -E 'my $seq = Math::NumSeq::Fibonacci->new(); do { $seq->seek_to_i($_); say 0+($seq->next)[1] } for 0..1000;' | md5sum 965b3e3787b56f2147843171366e835b -