Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • I came up with the following code recently as an experiment:

    use strict;
    use Math::BigFloat;
    use Time::HiRes;

    my $x = Math::BigFloat->new(my $str);
    my $start = (times)[0];
    my $end = (times)[0];
    my $elapsed = $end-$start;
    printf "%.100f".$x."\n";
    printf "that took %.100f CPU seconds.\n",$elapsed;

    My source for the calculation of pi is a formula attributed to Gauss in the 1977 Van Nostrand Reinhold "Encyclopedia of Mathematics." I was interested in seeing how fast this would run on different machines that I have.