19.11.2014 Views

The Fortress Language Specification - CiteSeerX

The Fortress Language Specification - CiteSeerX

The Fortress Language Specification - CiteSeerX

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

25.1.11 opr (self,other: Q):Boolean<br />

<strong>The</strong> comparison operators < , ≤ , = , ≥ , and > allow any rational value to be compared numerically to any other<br />

rational value.<br />

For types Q ∗ and Q # , the rational values are totally ordered except for 0/0 , which is unordered with respect to<br />

all other rational values; moreover, for compatibility with floating-point arithmetic, 0/0 is unordered with respect to<br />

itself, and therefore these five comparison operators always return false if either argument is 0/0 . <strong>The</strong> value −∞ is<br />

less than any finite rational value, and +∞ is greater than any finite rational value.<br />

For ≠ see Section 26.1.4.<br />

25.1.16 opr CMP(self,other: Q): TotalComparison<br />

25.1.17 opr CMP(self,other: Q # ):Comparison<br />

<strong>The</strong> CMP operator compares the arguments and returns one of the four values LessThan, EqualTo, GreaterThan,<br />

and Unordered. If the argument types are such that the result cannot be Unordered, then the result has type<br />

TotalComparison rather than simply Comparison.<br />

25.1.18 opr MAX(self,other: Q): Q<br />

25.1.19 opr MIN(self,other: Q): Q<br />

25.1.20 opr MAXNUM(self,other: Q): Q<br />

25.1.21 opr MINNUM(self,other: Q): Q<br />

<strong>The</strong> operators MAX and MAXNUM return whichever argument is larger in the total order defined by < , ≤ , = , ≥ , > ,<br />

and CMP , and the operators MIN and MINNUM return whichever argument is smaller. (For all four, if the arguments<br />

are equal, then the result equals that same value.)<br />

For type Q # , MAXNUM and MINNUM differ from MAX and MIN in their treatment of 0/0 : if one argument is 0/0 and<br />

the other is not, then MAX or MIN returns 0/0 but MAXNUM or MINNUM returns the argument that is not 0/0 .<br />

25.1.22 opr |self| : Q ≥<br />

<strong>The</strong> absolute value operator |. . .| returns the negative of this rational number if the argument is less than zero, and<br />

otherwise returns the argument.<br />

For type Q # , the absolute value of 0/0 is 0/0 .<br />

197

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!