Perl high precision calculation

If you want to make a high precision calculation with Perl you could use the bignum module.As little example:

print 4/3,"\n";
use bignum;
print 4/3,"\n";

And we could see the second result has a better accuracy than the default:



But you could improve this by setting the precision in Significant figures, like in this example we want 60.

print sqrt(20),"\n";
use bignum ( p => -60 );;
print sqrt(20),"\n";

As result we get:



3 thoughts on “Perl high precision calculation”

  1. I was more than happy to discover this web site. I wanted to thank
    you for ones time for this wonderful read!!
    I definitely enjoyed every bit of it and i also have you saved
    to fav to see new stuff on your blog.

  2. Every weekend i used to visit this web page, for the reason that i want
    enjoyment, as this this web site conations truly fastidious funny information too.

  3. It’s actually a nice and helpful piece of information. I am glad that
    you shared this useful info with us. Please stay us informed like this.
    Thanks for sharing.

Leave a Reply

Your email address will not be published.

5 × five =