User Tools


Differences

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

Link to this comparison view

cl:functions:phase [2019/06/15 02:00]
cl:functions:phase [2019/09/16 13:00] (current)
Line 1: Line 1:
 +====== Function PHASE ======
 +
 +====Syntax====
 +  * **phase** //number// → //phase//
 +
 +====Arguments and Values====
 +  * //number// - a //​[[CL:​Glossary:​number]]//​.
 +  * //phase// - a //​[[CL:​Glossary:​number]]//​.
 +
 +====Description====
 +**phase** returns the phase of //number// (the angle part of its polar representation) in radians, in the range ''​-π''​ (exclusive) if minus zero is not supported, or ''​-π''​ (inclusive) if minus zero is supported, to ''​π''​ (inclusive). The phase of a positive //​[[CL:​Glossary:​real]]//​ number is zero; that of a negative //​[[CL:​Glossary:​real]]//​ number is ''​π''​. The phase of zero is defined to be zero.
 +
 +If //number// is a //​[[CL:​Glossary:​complex float]]//, the result is a //​[[CL:​Glossary:​float]]//​ of the same //​[[CL:​Glossary:​type]]//​ as the components of //number//. If //number// is a //​[[CL:​Glossary:​float]]//,​ the result is a //​[[CL:​Glossary:​float]]//​ of the same //​[[CL:​Glossary:​type]]//​. If //number// is a //​[[CL:​Glossary:​rational]]//​ or a //​[[CL:​Glossary:​complex rational]]//,​ the result is a //​[[CL:​Glossary:​single float]]//.
 +
 +The branch cut for **phase** lies along the negative real axis, continuous with quadrant II. The range consists of that portion of the real axis between ''​-π''​ (exclusive) and~''​π''​ (inclusive).
 +
 +The mathematical definition of **phase** is as follows:
 +
 +''​(phase ''​x''​) = ([[CL:​Functions:​atan]] ([[CL:​Functions:​imagpart]] ''​x''​) ([[CL:​Functions:​realpart]] ''​x''​))''​
 +
 +====Examples====
 +<​blockquote> ​
 +(phase 1) <​r>​0.0s0 </r>
 +(phase 0) <​r>​0.0s0 </r>
 +(phase ([[CL:​Functions:​cis]] 30)) <​r>​-1.4159266 </r>
 +(phase #c(0 1)) <​r>​1.5707964 </r>
 +</​blockquote>​
 +
 +====Side Effects====
 +None.
 +
 +====Affected By====
 +None.
 +
 +====Exceptional Situations====
 +Should signal **[[CL:​Types:​type-error]]** if its argument is not a //​[[CL:​Glossary:​number]]//​. Might signal **[[CL:​Types:​arithmetic-error]]**.
 +
 +====See Also====
 +  * {\secref\FloatSubstitutability}
 +
 +====Notes====
 +None.
 +
 +\issue{IEEE-ATAN-BRANCH-CUT:​SPLIT} \issue{REAL-NUMBER-TYPE:​X3J13-MAR-89} \issue{REAL-NUMBER-TYPE:​X3J13-MAR-89} \issue{IEEE-ATAN-BRANCH-CUT:​SPLIT}