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

Senthil Kumaran said...

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