DRealSupport.mesa
Copyright Ó 1989, 1991 by Xerox Corporation. All rights reserved.
Russ Atkinson (RRA) June 22, 1989 10:09:33 pm PDT
DIRECTORY FloatingPointCommon;
DRealSupport: CEDAR DEFINITIONS = BEGIN
The following procedures are the primitive low-level support for the Cedar/Mesa DREAL type.
Classify: PROC [d: DREAL] RETURNS [FloatingPointCommon.NumberType];
Classifies the given DREAL.
Example: PROC [c: FloatingPointCommon.NumberType, min: BOOL ¬ FALSE] RETURNS [DREAL];
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 DREAL 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.
DRealToReal: PROC [d: DREAL] RETURNS [REAL];
IntToDReal: PROC [i: INT] RETURNS [DREAL];
CardToDReal: PROC [c: CARD] RETURNS [DREAL];
RealToDReal: PROC [r: REAL] RETURNS [DREAL];
Fix: PROC [x: DREAL] RETURNS [INT];
... rounds toward zero (error if outside the INT range)
Round: PROC [x: DREAL] RETURNS [INT];
... rounds toward nearest (error if outside the INT range)
FScale: PROC [a: DREAL, scale: INTEGER] RETURNS [DREAL]; -- a*(2­scale)
Neg: PROC [d: DREAL] RETURNS [DREAL];
Abs: PROC [d: DREAL] RETURNS [DREAL];
Add: PROC [x, y: DREAL] RETURNS [DREAL];
Sub: PROC [x, y: DREAL] RETURNS [DREAL];
Mul: PROC [x, y: DREAL] RETURNS [DREAL];
Div: PROC [x, y: DREAL] RETURNS [DREAL];
Gt: PROC [x, y: DREAL] RETURNS [BOOL];
Ge: PROC [x, y: DREAL] RETURNS [BOOL];
Lt: PROC [x, y: DREAL] RETURNS [BOOL];
Le: PROC [x, y: DREAL] RETURNS [BOOL];
Eq: PROC [x, y: DREAL] RETURNS [BOOL];
Ne: PROC [x, y: DREAL] RETURNS [BOOL];
Min: PROC [x, y: DREAL] RETURNS [DREAL];
Max: PROC [x, y: DREAL] RETURNS [DREAL];
Pwr: PROC [x, y: DREAL] RETURNS [DREAL];
Floor: PROC [x: DREAL] RETURNS [DREAL];
Ceiling: PROC [x: DREAL] RETURNS [DREAL];
END.