Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Answer: How can I get sine, cosine, and tangent to return values in degrees?

by barrachois (Pilgrim)
on Dec 30, 2002 at 21:01 UTC ( #223177=categorized answer: print w/replies, xml ) Need Help??

Q&A > math > How can I get sine, cosine, and tangent to return values in degrees? - Answer contributed by barrachois

Rather than have a line like this
my $pi = 3.14159265358979;
which requires you to choose how many digits of pi you (or your operating system) want, and even may require (for some, at least) that you look up the value of pi, I would suggest that a line like this instead will do the right thing.
my $pi = 4*atan2(1,1);

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2017-03-26 02:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (313 votes). Check out past polls.