About Me

My photo

-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS/E/B d-- s:++>: a-- C++(++++) UL++ P! L++ E--- W+++ N+++ w PS+ PE- !tv
b+++ G++ e++ h
------END GEEK CODE BLOCK------

Tuesday, September 27, 2005

shell pi

pi=$(echo "scale=10; 4*a(1)" | bc -l)

ok; bc -l gives floating point value.
a(1) returns arc tangent of 1.
scale is the scable you assign to the bc.

how 4 * a(1) is pi?

2 comments:

Kannappan said...

a(1) is 45 degrees, so

phoe6 said...

and pi is 180 degrees.
thanks :) I lost touch with the radians and angle things.