User Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

cl:constant_variables:pi [2019/10/13 03:00]
cl:constant_variables:pi [2019/10/18 02:00] (current)
Line 1: Line 1:
 +====== Constant Variable PI ======
 +
 +====Value====
 +an //​[[CL:​Glossary:​implementation-dependent]]//​ //​[[CL:​Glossary:​long float]]//.
 +
 +====Description====
 +The best //​[[CL:​Glossary:​long float]]// approximation to the mathematical constant ''​π''​.
 +
 +====Examples====
 +In each of the following computations,​ the precision depends on the //​[[CL:​Glossary:​implementation]]//​. Also, if //​[[CL:​Glossary:​long float]]// is treated by the //​[[CL:​Glossary:​implementation]]//​ as equivalent to some other //​[[CL:​Glossary:​float]]//​ format (e.g., //​[[CL:​Glossary:​double float]]//) the exponent marker might be the marker for that equivalent (e.g., ''​D''​ instead of ''​L''​). ​
 +<​blockquote> ​
 +pi <​r>​3.141592653589793L0 </r>
 +([[CL:​Functions:​cos]] pi) <​r>​-1.0L0</​r>​
 +([[CL:​Macros:​defun]] sin-of-degrees (degrees) ​
 +  ([[CL:​Special Operators:​let]] ((x ([[CL:​Special Operators:​if]] ([[CL:​Functions:​floatp]] degrees) ​
 +               ​degrees ​
 +               ​([[CL:​Functions:​float]] degrees pi)))) ​
 +    ([[CL:​Functions:​sin]] ([[CL:​Functions:​math-multiply*]] x ([[CL:​Functions:​math-divide|/​]] ([[CL:​Functions:​float]] pi x) 180)))))
 +[[CL:​Functions:​SIN-OF-DEGREES]]
 +</​blockquote>​
 +
 +====See Also====
 +None.
 +
 +====Notes====
 +An approximation to ''​π''​ in some other precision can be obtained by writing ''​([[CL:​Functions:​float]] pi x)'',​ where ''​x''​ is a //​[[CL:​Glossary:​float]]//​ of the desired precision, or by writing ''​(coerce pi //​type//​)'',​ where //type// is the desired type, such as **[[CL:​Types:​short-float]]**.