User Tools


Differences

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

Link to this comparison view

cl:functions:math-equal [2019/11/11 05:00]
cl:functions:math-equal [2019/11/14 16:00] (current)
Line 1: Line 1:
 +====== Function =, /=, <, >, <=, >= ======
 +
 +====Syntax====
 +  * **=** //''&​rest''​ numbers''​+''//​ → //​generalized-boolean// ​
 +  * **/=** //''&​rest''​ numbers''​+''//​ → //​generalized-boolean// ​
 +  * **<** //''&​rest''​ numbers''​+''//​ → //​generalized-boolean// ​
 +  * **>** //''&​rest''​ numbers''​+''//​ → //​generalized-boolean// ​
 +  * **<=** //''&​rest''​ numbers''​+''//​ → //​generalized-boolean// ​
 +  * **>=** //''&​rest''​ numbers''​+''//​ → //​generalized-boolean//​
 +
 +====Arguments and Values====
 +  * //number// - for **<**, **>**, **<=**, **>=**: a //​[[CL:​Glossary:​real]]//;​ for **=**, **/=**: a //​[[CL:​Glossary:​number]]//​.
 +  * //​generalized-boolean//​ - a //​[[CL:​Glossary:​generalized boolean]]//​.
 +
 +====Description====
 +**=**, **/=**, **<**, **>**, **<=**, and **>=** perform arithmetic comparisons on their arguments as follows:
 +
 +===<​nowiki>​=</​nowiki>​===
 +The value of **=** is //​[[CL:​Glossary:​true]]//​ if all //numbers// are the same in value; otherwise it is //​[[CL:​Glossary:​false]]//​. Two //​[[CL:​Glossary:​complexes]]//​ are considered equal by **=** if their real and imaginary parts are equal according to **=**.
 +
 +===<​nowiki>/​=</​nowiki>​===
 +The value of **/=** is //​[[CL:​Glossary:​true]]//​ if no two //numbers// are the same in value; otherwise it is //​[[CL:​Glossary:​false]]//​.
 +
 +===<​nowiki><</​nowiki>​===
 +The value of **<** is //​[[CL:​Glossary:​true]]//​ if the //numbers// are in monotonically increasing order; otherwise it is //​[[CL:​Glossary:​false]]//​.
 +
 +===<​nowiki>></​nowiki>​===
 +The value of **>** is //​[[CL:​Glossary:​true]]//​ if the //numbers// are in monotonically decreasing order; otherwise it is //​[[CL:​Glossary:​false]]//​.
 +
 +===<​nowiki><​=</​nowiki>​===
 +The value of **<=** is //​[[CL:​Glossary:​true]]//​ if the //numbers// are in monotonically nondecreasing order; otherwise it is //​[[CL:​Glossary:​false]]//​.
 +
 +===<​nowiki>>​=</​nowiki>​===
 +The value of **>=** is //​[[CL:​Glossary:​true]]//​ if the //numbers// are in monotonically nonincreasing order; otherwise it is //​[[CL:​Glossary:​false]]//​.
 +
 +**=**, **/=**, **<**, **>**, **<=**, and **>=** perform necessary type conversions.
 +
 +====Examples====
 +The uses of these functions are illustrated in the below table.
 +| ''​(= 3 3)''​ is //​[[CL:​Glossary:​true]]//​. ​            | ''​(/​= 3 3)''​ is //​[[CL:​Glossary:​false]]//​. ​           |
 +| ''​(= 3 5)''​ is //​[[CL:​Glossary:​false]]//​. ​           | ''​(/​= 3 5)''​ is //​[[CL:​Glossary:​true]]//​. ​            |
 +| ''​(= 3 3 3 3)''​ is //​[[CL:​Glossary:​true]]//​. ​        | ''​(/​= 3 3 3 3)''​ is //​[[CL:​Glossary:​false]]//​. ​       |
 +| ''​(= 3 3 5 3)''​ is //​[[CL:​Glossary:​false]]//​. ​       | ''​(/​= 3 3 5 3)''​ is //​[[CL:​Glossary:​false]]//​. ​       |
 +| ''​(= 3 6 5 2)''​ is //​[[CL:​Glossary:​false]]//​. ​       | ''​(/​= 3 6 5 2)''​ is //​[[CL:​Glossary:​true]]//​. ​        |
 +| ''​(= 3 2 3)''​ is //​[[CL:​Glossary:​false]]//​. ​         | ''​(/​= 3 2 3)''​ is //​[[CL:​Glossary:​false]]//​. ​         |
 +| ''​(<​ 3 5)''​ is //​[[CL:​Glossary:​true]]//​. ​            | ''​(<​= 3 5)''​ is //​[[CL:​Glossary:​true]]//​. ​            |
 +| ''​(<​ 3 -5)''​ is //​[[CL:​Glossary:​false]]//​. ​          | ''​(<​= 3 -5)''​ is //​[[CL:​Glossary:​false]]//​. ​          |
 +| ''​(<​ 3 3)''​ is //​[[CL:​Glossary:​false]]//​. ​           | ''​(<​= 3 3)''​ is //​[[CL:​Glossary:​true]]//​. ​            |
 +| ''​(<​ 0 3 4 6 7)''​ is //​[[CL:​Glossary:​true]]//​. ​      | ''​(<​= 0 3 4 6 7)''​ is //​[[CL:​Glossary:​true]]//​. ​      |
 +| ''​(<​ 0 3 4 4 6)''​ is //​[[CL:​Glossary:​false]]//​. ​     | ''​(<​= 0 3 4 4 6)''​ is //​[[CL:​Glossary:​true]]//​. ​      |
 +| ''​(>​ 4 3)''​ is //​[[CL:​Glossary:​true]]//​. ​            | ''​(>​= 4 3)''​ is //​[[CL:​Glossary:​true]]//​. ​            |
 +| ''​(>​ 4 3 2 1 0)''​ is //​[[CL:​Glossary:​true]]//​. ​      | ''​(>​= 4 3 2 1 0)''​ is //​[[CL:​Glossary:​true]]//​. ​      |
 +| ''​(>​ 4 3 3 2 0)''​ is //​[[CL:​Glossary:​false]]//​. ​     | ''​(>​= 4 3 3 2 0)''​ is //​[[CL:​Glossary:​true]]//​. ​      |
 +| ''​(>​ 4 3 1 2 0)''​ is //​[[CL:​Glossary:​false]]//​. ​     | ''​(>​= 4 3 1 2 0)''​ is //​[[CL:​Glossary:​false]]//​. ​     |
 +| ''​(= 3)''​ is //​[[CL:​Glossary:​true]]//​. ​              | ''​(/​= 3)''​ is //​[[CL:​Glossary:​true]]//​. ​              |
 +| ''​(<​ 3)''​ is //​[[CL:​Glossary:​true]]//​. ​              | ''​(<​= 3)''​ is //​[[CL:​Glossary:​true]]//​. ​              |
 +| ''​(= 3.0 #c(3.0 0.0))''​ is //​[[CL:​Glossary:​true]]//​. | ''​(/​= 3.0 #c(3.0 1.0))''​ is //​[[CL:​Glossary:​true]]//​. |
 +| ''​(= 3 3.0)''​ is //​[[CL:​Glossary:​true]]//​. ​          | ''​(= 3.0s0 3.0d0)''​ is //​[[CL:​Glossary:​true]]//​. ​     |
 +| ''​(= 0.0 -0.0)''​ is //​[[CL:​Glossary:​true]]//​. ​       | ''​(= 5/2 2.5)''​ is //​[[CL:​Glossary:​true]]//​. ​         |
 +| ''​(>​ 0.0 -0.0)''​ is //​[[CL:​Glossary:​false]]//​. ​      | ''​(= 0 -0.0)''​ is //​[[CL:​Glossary:​true]]//​. ​          |
 +| ''​(<​= 0 x 9)''​ is //​[[CL:​Glossary:​true]]//​ if ''​x''​ is between ''​0''​ and ''​9'',​ inclusive. ​                 ||
 +| ''​(<​ 0.0 x 1.0)''​ is //​[[CL:​Glossary:​true]]//​ if ''​x''​ is between ''​0.0''​ and ''​1.0'',​ exclusive. ​          ||
 +| ''​(<​ -1 j ([[CL:​Functions:​length]] v))''​ is //​[[CL:​Glossary:​true]]//​ if ''​j''​ is a //​[[CL:​Glossary:​valid array index]]// for a //​[[CL:​Glossary:​vector]]//​ ''​v''​. ||
 +
 +
 +====Affected By====
 +None.
 +
 +====Exceptional Situations====
 +Might signal **[[CL:​Types:​type-error]]** if some //​[[CL:​Glossary:​argument]]//​ is not a //​[[CL:​Glossary:​real]]//​. Might signal **[[CL:​Types:​arithmetic-error]]** if otherwise unable to fulfill its contract.
 +
 +====See Also====
 +None.
 +
 +====Notes====
 +**=** differs from **[[CL:​Functions:​eql]]** in that ''​(= 0.0 -0.0)''​ is always true, because **=** compares the mathematical values of its operands, whereas **[[CL:​Functions:​eql]]** compares the representational values, so to speak.
 +