If you want to make a high precision calculation with Perl you could use the bignum module.As little example:
1 2 3 4 |
#!/usr/bin/perl print 4/3,"\n"; use bignum; print 4/3,"\n"; |
And we could see the second result has a better accuracy than the default:
1 2 |
1.33333333333333 1.333333333333333333333333333333333333333 |
But you could improve this by setting the precision in Significant figures, like in this example we want 60.
1 2 3 4 |
#!/usr/bin/perl print sqrt(20),"\n"; use bignum ( p => -60 );; print sqrt(20),"\n"; |
As result we get:
1 2 |
4.47213595499958 4.472135954999579392818347337462552470881236719223051448541794 |
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.
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.
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.