Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^3: bc within perl

by choroba (Cardinal)
on Nov 08, 2016 at 10:06 UTC ( [id://1175534]=note: print w/replies, xml ) Need Help??


in reply to Re^2: bc within perl
in thread bc within perl

> That has a restriction of 64bit binary

Are you sure?

perl -Mbigint -wE 'say 12345678912345678912345678912345678912345678912 +3456789123456789 ** 1234'

Replies are listed 'Best First'.
Re^4: bc within perl
by amudelkaa (Novice) on Nov 08, 2016 at 13:22 UTC
    So this is bigint and not BigInt? Because when I tried doing the same with BigInt, the data hit the ceiling of xffffffffffffffff.

      Math::BigInt implements the code for arbitrary precision. bigint enables that code transparently wherever it is used.

      > with BigInt, the data hit the ceiling of xffffffffffffffff.

      Show the code. It works for me:

      #!/usr/bin/perl use warnings; use strict; use feature qw{ say }; use Math::BigInt; my $x = 'Math::BigInt'->new('123456789' x 5); say $x ** 1234;

      ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
        That's again my bad. I tried to do a sprintf after the math op using BigInt. BigInt is just fine and I am stupid enough to doubt it.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2024-04-26 00:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found