pjacklam / p5-math-bigint Goto Github PK
View Code? Open in Web Editor NEWThis project forked from rafl/math-bigint
License: Other
This project forked from rafl/math-bigint
License: Other
Hi,
as reported by Klaus Ethgen in https://bugs.debian.org/1012704 this hangs with recent versions of Math-BigInt:
% perl -Mbignum -e '1 | (1 >> 1)'
Deep recursion on subroutine "Math::BigInt::bior" at /usr/share/perl5/Math/BigFloat.pm line 3883.
Deep recursion on subroutine "Math::BigFloat::bior" at /usr/share/perl5/Math/BigInt.pm line 3513.
Also happens with other bitwise operations like & and ^ .
It seems to have regressed around 1.999832 (where it started to spit errors) and 1.999834 (where the errors became infinite recursion.)
In LedgerSMB, we have a class called LedgerSMB::PGNumber
which ultimately ISA
Math::BigFloat
. Since this class adds a few methods, it's important that the result of each operation remains of the same class. While this used to work pretty well (mostly deployed on Debian versions), this is now broken (on Debian Bookworm). Going back to Bullseye and installing the latest Math::BigInt distribution from CPAN breaks the same way.
Reading CHANGES, I suspect 1.999830
and 1.999831
: Bullseye has 1.999818
and Bookworm has 1.999838
.
Could you please indicate whether the current state is permanent? If so, what is your advice as to how to deal with the situation?
Should you need to look at the code, the LedgerSMB::PGNumber
code is here. It's inheriting from Math::BigFloat through here
Was previously running Math-BigInt-1.999818. Tried to upgrade and found unexpected behavior when calling numify after a bfround.
my $f = Math::BigFloat->new(123456.123456);
say $f->bfround(-2)->numify;
# 123000
Since this repo is now the official one, or at least the advertised one on MetaCPAN
Note that two PRs are pending from
https://github.com/rafl/Math-BigInt/pulls
I'm unsure about their state, if they are already merged here or not.
it would be good to close future PR to the parent repo, and point them here instead.
As seen here https://github.com/pjacklam/p5-Math-BigInt/tags
the last tag available is 1.999813, we are already at 1.999828
Having tags is convenient to use GitHub UI to perform some quick compare for example or even from the command line.
Unfortunately I do not have permission to create these tags, I will gladly help and provide them if needed.
Thanks for considering creating these tags
It looks like 46d1252 / 1.999836 broke numerical equivalence of Math::BigFloat subclass instances with Math::BigFloat instances. This affects at least the LedgerSMB test suite via the PGObject-Type-BigFloat CPAN module, which is how we noticed it in https://bugs.debian.org/1043234 .
A test case is
package MyFloat;
use base qw(Math::BigFloat);
1;
print MyFloat->new(9999.99) == Math::BigFloat->new(9999.99) ? "ok\n": "not ok\n";
print Math::BigFloat->new(9999.99) == MyFloat->new(9999.99) ? "ok\n": "not ok\n";
which fails the first test (but not the second one.)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.