Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Math::BigRat Dump Fails on Eval

by SuicideJunkie (Vicar)
on Apr 23, 2014 at 20:19 UTC ( [id://1083440]=note: print w/replies, xml ) Need Help??


in reply to Math::BigRat Dump Fails on Eval

Please fix your post, it is breaking the formatting.

As to your problem, consider the following code:

use Math::BigRat; my $num = Math::BigRat->new(157156424579004107729662594024339596952518 +6964287593983211702071746502379495623702577); my $num2 = Math::BigRat->new('1571564245790041077296625940243395969525 +186964287593983211702071746502379495623702577'); print "Numeric: $num\n"; print "Stringy: $num2\n";
c:\>perl test.pl Numeric: 1571564245790040000000000000000000000000000000000000000000000 +000000000000000000000000 Stringy: 1571564245790041077296625940243395969525186964287593983211702 +071746502379495623702577 c:\>_

In the first case, you're trying to make a constant number which has to be passed in to bigrat as a float. In the second case, bigrat gets all the digits nicely.

Replies are listed 'Best First'.
Re^2: Math::BigRat Dump Fails on Eval
by jabowery (Beadle) on Apr 23, 2014 at 22:47 UTC

    So I guess what you're saying is I need to fix the interface between Data::Dump and Math::BigRat -- because it is in that interface that the quotes are being left out.

    UPDATE: There was a buggy filter callback in my call to dumpf:

    sub{my ($ctx,$self)=@_;$ctx->object_isa('Math::BigRat')?{dump=>"Math::BigRat->new($self)"}

    As for the formatting of the original post, you didn't specify what was 'broken' about the formatting but I did notice that there was no download link, and I put some white space into the source (CR before and after the code tags) to fix that.

    If it is the lack of wrapping you are referring to, the only help I found was in the "Writeup Formatting Tips" where they discuss only "Display Settings", which places the burden on the reader to specify auto-wrapping.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1083440]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-04-20 02:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found