Skip Menu |

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

Report information
The Basics
Id: 19276
Status: resolved
Worked: 10 min
Priority: 0/
Queue: Math-BigInt

People
Owner: TELS [...] cpan.org
Requestors: eastonbeymer [...] cox.net
Cc:
AdminCc:

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



Subject: bignum error...
Date: Mon, 15 May 2006 12:13:48 -0700
To: <bug-Math-BigInt [...] rt.cpan.org>
From: "Easton Beymer" <eastonbeymer [...] cox.net>
Hi again, Tels, I have moved this message to a to a pop3, smtp mail server... Thanks for putting in the request to delete the message with the attachments. I figured I was really pushing the limits of tieing and overloading, but cobol and big bcd integer processing (including scaling) with the absence of floating point rounding errors is basic to cobol -- cobol requires accuracy to the penny. This package is really aimed at Perl 6 and Parrot (is there ever really going to be such a thing in my lifetime???). In order to emulate the data structures and data types inherent in cobol, it was necessary to use tied variables. I am not particularly concerned about performance with the bignum package -- it is more important to me to be able to accurately mirror the accuracy spelled out the the cobol standard. I will make the change to "Cobol" for the package name. I am wanting to implement rounding on an arithmetic statement by statement basis, but am lost as to how to implement this in bignum. Good examples seem to be lacking. Again, thanks... Easton -------------------------------------------------------------------------------- Show quoted text
> Subject: Re: [rt.cpan.org #19253] Error in bignum, BigInt... > From: bug-Math-BigInt@rt.cpan.org > To: eastonbeymer@hotmail.com > Date: Mon, 15 May 2006 14:14:00 -0400 > > > <URL: http://rt.cpan.org/Ticket/Display.html?id=19253 > > > Moin, > > On Monday 15 May 2006 19:18, eastonbeymer@hotmail.com via RT wrote:
> > Queue: Math-BigInt > > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=19253 > > > > > Hi Tels, > > > > I tried coming up with a stripped down version, but the error goes away > > once I start stripping... > > > > Attached are the full programs causing the problem. > > > > Cobol.pm is the code for a runtime package for a cobol compiler written > > in Perl, and I consider it to be proprietary at this time.
> > Unfortunately, you just posted it to rt.cpan.org, a public website :) > > I will try to see what's causing the problem, but it is very likely tie > plus the overload from bignum/bigint. Both bigint/bignum and bigrat are a > cheat/trick to trick Perl into working with long numbers. It works for > simple cases, but breaks down for more complicated stuff due to hairy > edge cases - a bigint is an overloaded object and a lot of code does not > expect to get something else than a scalar. > > So in many cases it is better to use Math::BigInt (or BigFloat) > explicitely and use only long math when really nec. This also makes > things much faster, generally :) > > Some comments: > > * Please use an uppercase first letter for packages so "use Cobol;" and > not "use cobol;" unless you really want to write a pragma (which is some > sort of special package reserved for internal stuff enhancing Perl :) > * I don't have Win32/Console.pm - I took out the references to it and the > error occurs, so I guess it doesn't matter for this bug. > > Thanx for your report, > > Tels > > -- > Signed on Mon May 15 20:07:25 2006 with key 0x93B84C15. > Visit my photo gallery at http://bloodgate.com/photos/ > PGP key on http://bloodgate.com/tels.asc or per email. > > "Remember: If the game let's you do it, it's not cheating." -- Xarax > >
I am not sure what exactly you are trying to acomplish, so a bit Perl code with "expected here XYZ" lines would be good. Have you looked at the global rounding parameters: use Math::BigFloat; Math::BigFloat->accuracy(5); my $x = Math::BigFloat->new("1.2345678"); print "$x\n"; $x += '0.12345678'; print "$x\n"; Another method would be to create a subclass of Math::BigFloat and overload all the math operators. There is an example in the testsuite under t/Math/BigFloat/Subclass.pm for a minimal code. Best wishes, Tels
Marking this as resolved since I can't figure out what the actual problem is, or what I should do. If you still have problems, please reply to this message to reopen the bug.