Skip Menu |

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

Report information
The Basics
Id: 17600
Status: open
Priority: 0/
Queue: Math-NumberCruncher

People
Owner: sifukurt [...] yahoo.com
Requestors: ntyni [...] iki.fi
Cc:
AdminCc:

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



Subject: Incompatibility with Math::BigInt >= 1.49
Hi, when using Math::NumberCruncher with current versions (>= 1.49) of Math::BigInt, the Predict() function can not handle data generated by BestFit(), but rather returns NaN. This occurs because BestFit() explicitly rounds its return values into a fixed precision, but Predict() calls Math::BigFloat::bmul with an explicit accuracy. Since version 1.49 Math::BigInt::round enforces that its operands must have either a specified precision or specified accuracy. If these are different, NaN is returned from Math::BigInt::round(), called by Math::BigFloat::bmul(). I'm attaching a patch for test.pl that detects this bug. The bug can be worked around by setting $slope->accuracy(undef) and $y_intercept->accuracy(undef) before calling Predict(). Since there are lots of similar calls to bmul() in Math::NumberCruncher, I suspect that this is a more general problem. For the record, this bug was originally reported by Thomas Walter in the Debian bug tracking database as bug #352393, http://bugs.debian.org/352393 . I have verified this bug on Debian GNU/Linux with Perl versions 5.6.1, 5.8.4 and 5.8.7 with Math::BigInt versions 1.56, 1.70 and 1.77 Cheers, -- Niko Tyni (on behalf of the Debian Perl Group) ntyni@iki.fi
Subject: NaN-test
Download NaN-test
application/octet-stream 688b

Message body not shown because it is not plain text.

I suspect that the bug I came here to a report is caused by the same problem. CORE::sin(0.78539816339744827899949086713605)=0.70710678118654746171500846685376 M_NR::sin(0.78539816339744827899949086713605)=0.00000000000000000000000000000000
On Sun Dec 10 03:27:18 2006, JPIERCE wrote: Show quoted text
> I suspect that the bug I came here to a report is caused by the same > problem. > >
CORE::sin(0.78539816339744827899949086713605)=0.70710678118654746171500846685376 Show quoted text
>
M_NR::sin(0.78539816339744827899949086713605)=0.00000000000000000000000000000000 To clarify, that .7853... is the result of deg2rad(45). The function resturns a reasonable result if you provide the strong .7853... as the argument.