Table of contents
CSPICE_PI returns the double precision value of the constant PI.
The call:
pi = cspice_pi( )
returns:
pi the value of pi (the ratio of a circle's circumference to its
diameter), determined by the acos function.
help, pi
DOUBLE = Scalar
That is,
cspice_pi = acos ( -1.0 )
None.
Any numerical results shown for this example may differ between
platforms as the results depend on the SPICE kernels used as input
and the machine specific arithmetic implementation.
1) The following code example returns the double precision value of
the constant pi and prints it out.
Example code begins here.
PRO pi_ex1
;;
;; Print the double precision value of PI
;;
print, FORMAT='("Pi: ",F25.22)', cspice_pi()
END
When this program was executed on a Mac/Intel/IDL8.x/64-bit
platform, the output was:
Pi: 3.1415926535897931159980
Note that the IDL system variable !DPI returns a double precision
value for PI that equates the value returned by cspice_pi, to
machine roundoff.
The IDL system variable !PI returns a single precision (float)
value for PI that equates to the value returned by the expression
float( cspice_pi() )
The first time the function is referenced, the value is computed
as shown above. The value is saved, and returned directly upon
subsequent reference.
Error free.
None.
None.
ICY.REQ
None.
J. Diaz del Rio (ODC Space)
E.D. Wright (JPL)
-Icy Version 1.0.2, 25-AUG-2021 (JDR)
Edited the header to comply with NAIF standard. Added example's
problem statement and reformatted example's output.
Added -Parameters, -Particulars, -Exceptions, -Files, -Restrictions,
-Literature_References and -Author_and_Institution sections.
Removed reference to the routine's corresponding CSPICE header from
-Abstract section.
Added argument's type and size information in the -I/O section.
-Icy Version 1.0.1, 13-JUN-2010 (EDW)
Minor edit to code comments eliminating typo.
-Icy Version 1.0.0, 16-JUN-2003 (EDW)
value of pi
|