Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: Pascal's triangle...

by particle (Vicar)
on Jun 19, 2002 at 11:25 UTC ( [id://175625]=note: print w/replies, xml ) Need Help??


in reply to Re: Pascal triange...
in thread Pascal's triangle...

use constant PI => 3.141592653589793238;
since you're only calculating pi once, and inlining it, take advantage of the operating system's precision...

use constant PI => 4 * atan 1, 1; ## or as i prefer # sub PI() { 4 * atan 1, 1 }

~Particle *accelerates*

Replies are listed 'Best First'.
•constant PI
by merlyn (Sage) on Jun 19, 2002 at 13:16 UTC
(jeffa) 3Re: Pascal triange...
by jeffa (Bishop) on Jun 19, 2002 at 17:51 UTC
    Yet another way:
    use Math::Complex; use constant PI => pi(); # or just pi();

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)
    
Re^3.14: Pascal's triangle...
by particle (Vicar) on Jun 19, 2002 at 22:14 UTC
    or in kansas...

    use constant PI => 3;
    ;-P

    ~Particle *accelerates*

      > or in kansas...

      > use constant PI => 3;

      Actually, in Kansas we think PI should be round,

      use constant PI => sprintf("%1.0f", 3.14159265358979);

      You're thinking of Oklahoma...

      YuckFoo

Re(3): Pascal triange...
by gumby (Scribe) on Jun 19, 2002 at 11:45 UTC
    use constant PI => 4 * atan2 1, 1;
    I can recall from memory more than 700 digits of pi ;-)
Re: Re^2: Pascal's triangle...
by theorbtwo (Prior) on Jun 19, 2002 at 22:26 UTC

    BTW, that's the FPU's precision, not the OS's. (On machines that have an FPU, anyway.)

    /me is pedantic sometimes


    We are using here a powerful strategy of synthesis: wishful thinking. -- The Wizard Book

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (5)
As of 2024-03-28 12:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found