RealSupport.mesa
Copyright Ó 1989, 1991 by Xerox Corporation. All rights reserved.
Russ Atkinson (RRA) June 22, 1989 9:44:10 pm PDT
DIRECTORY FloatingPointCommon;
RealSupport: CEDAR DEFINITIONS = BEGIN
The following procedures are the primitive low-level support for the Cedar/Mesa REAL type.
Classify: PROC [d: REAL] RETURNS [FloatingPointCommon.NumberType];
Classifies the given REAL.
Example: PROC [c: FloatingPointCommon.NumberType, min: BOOL ¬ FALSE] RETURNS [REAL];
Returns an example of the given classification.
For all values of c except other, the classification of the result will be c.
If c = other, the result value is undefined, since there may be no REAL values that classify as other (this is machine-dependent). The value of min is ignored.
If c = zero, +0.0 will be returned. The value of min is ignored.
If c = subnormal OR c = normal, the example returned will be the minimum value in that classification if min = TRUE, or the maximum value in that classification if min = FALSE.
IF c is in {infinity, quiet, signaling}, a "typical" value will be returned, which may be the only value in that class (the details are machine-dependent). The value of min is ignored.
IntToReal: PROC [i: INT] RETURNS [REAL];
CardToReal: PROC [c: CARD] RETURNS [REAL];
Fix: PROC [REAL] RETURNS [INT];
... rounds toward zero (error if outside the INT range)
Round: PROC [REAL] RETURNS [INT];
... rounds toward nearest (error if outside the INT range)
FScale: PROC [a: REAL, scale: INTEGER] RETURNS [REAL]; -- a*(2­scale)
Neg: PROC [d: REAL] RETURNS [REAL];
Abs: PROC [d: REAL] RETURNS [REAL];
Add: PROC [x, y: REAL] RETURNS [REAL];
Sub: PROC [x, y: REAL] RETURNS [REAL];
Mul: PROC [x, y: REAL] RETURNS [REAL];
Div: PROC [x, y: REAL] RETURNS [REAL];
Gt: PROC [x, y: REAL] RETURNS [BOOL];
Ge: PROC [x, y: REAL] RETURNS [BOOL];
Lt: PROC [x, y: REAL] RETURNS [BOOL];
Le: PROC [x, y: REAL] RETURNS [BOOL];
Eq: PROC [x, y: REAL] RETURNS [BOOL];
Ne: PROC [x, y: REAL] RETURNS [BOOL];
Min: PROC [x, y: REAL] RETURNS [REAL];
Max: PROC [x, y: REAL] RETURNS [REAL];
Pwr: PROC [x, y: REAL] RETURNS [REAL];
Ceiling: PROC [x: REAL] RETURNS [REAL];
Floor: PROC [x: REAL] RETURNS [REAL];
END.