in reply to Re: enumerating values for slopes
in thread enumerating values for slopes

If high accuracy is important, maybe it would better to use a better approximation of pi (although I readily admit that 355/113 is already a pretty good approximation). For example:
my $pi = 4 * atan2(1, 1);
Or perhaps making it a constant:
use constant PI => 4 * atan2(1, 1);

Replies are listed 'Best First'.
Re^3: enumerating values for slopes
by Anonymous Monk on Sep 21, 2014 at 10:15 UTC
    Both Math::Trig and Math::BigFloat provide a pi constant
    $ perl -MMath::Trig -MMath::BigFloat=bpi -le " print for pi(), bpi(15) + " 3.14159265358979 3.14159265358979
      Yes, right, I was just commenting on the part of the code suggested by trippledubs not using these modules. And frankly, the BigFloat module is probably not very useful in the context, because bare Perl can make the slope calculations much more accurately than the measurements on which they are or seem to be based.
Re^3: enumerating values for slopes
by Aldebaran (Curate) on Sep 22, 2014 at 03:39 UTC

    One is never gonna outstrip a a c_double with measurements he makes with a carpenter's protractor, so Math::Trig has all the functionality I need here.