INTERFACEProperties of REAL (for ANSI/IEEE Standard 754-1985).Real ; IMPORT Word;
This package defines some basic properties of the built-in float type REAL.
Index: REAL; floating-point; generics
TYPE T = REAL;
CONST
Base: INTEGER = 2;
(* The radix of the floating-point representation for T *)
Precision: INTEGER = 24;
(* The number of digits of precision in the given Base for T. *)
MaxFinite: T = 3.40282347E+38;
(* The maximum finite value in T. For non-IEEE implementations,
this is the same as LAST(T). *)
MinPos: T = 1.40239846E-45;
(* The minimum positive value in T. *)
MinPosNormal: T = 1.17549435E-38;
(* The minimum positive "normal" value in T; differs from MinPos
only for implementations with denormalized numbers. *)
CONST
MaxExpDigits = 2;
MaxSignifDigits = 9;
MaxExpDigitsis the smallest integer with the property that every finite number of typeTcan be written in base-10 scientific notation using an exponent with at mostMaxExpDigits.MaxSignifDigitsis the smallest integer with the property that floating-decimal numbers withMaxSignifDigitsare more closely spaced, all along the number line, than are numbers of typeT. Typically,
MaxExpDigits = ceiling(log_10(log_10(MaxFinite)))
MaxSignifDigits = ceiling(log_10(Base^Precision)) + 1.
CONST Brand = "Real"; PROCEDURE Equal(a, b: T): BOOLEAN;
Returna = b. The result is undefined if eitheraorbis anNaN(not a number) value.
PROCEDURE Hash(a: T): Word.T;
Return a hash value derived froma. The result is undefined if eitheraorbis anNaN(not a number) value.
PROCEDURE Compare(a, b: T): [-1..1];
Return-1ifa < b,0ifa = b, or+1ifa > b. The result is undefined if eitheraorbis anNaN(not a number) value.
END Real.