INTERFACEProperties of LONGREAL (for ANSI/IEEE Standard 754-1985).LongReal ; IMPORT Word;
This package defines some basic properties of the built-in float type LONGREAL.
Index: LONGREAL; floating-point; generics
TYPE T = LONGREAL; CONST Base: INTEGER = 2; (* The radix of the floating-point representation for T *) Precision: INTEGER = 53; (* The number of digits of precision in the given Base for T. *) MaxFinite: T = 1.7976931348623157D+308; (* The maximum finite value in T. For non-IEEE implementations, this is the same as LAST(T). *) MinPos: T = 4.9406564584124654D-324; (* The minimum positive value in T. *) MinPosNormal: T = 2.2250738585072014D-308; (* The minimum positive "normal" value in T; differs from MinPos only for implementations with denormalized numbers. *) CONST MaxExpDigits = 3; MaxSignifDigits = 17;
MaxExpDigits
is the smallest integer with the property that every finite number of typeT
can be written in base-10 scientific notation using an exponent with at mostMaxExpDigits
.MaxSignifDigits
is the smallest integer with the property that floating-decimal numbers withMaxSignifDigits
are 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 = "LongReal"; PROCEDURE Equal(a, b: T): BOOLEAN;Returna = b
. The result is undefined if eithera
orb
is anNaN
(not a number) value.PROCEDURE Hash(a: T): Word.T;Return a hash value derived froma
. The result is undefined if eithera
orb
is anNaN
(not a number) value.PROCEDURE Compare(a, b: T): [-1..1];Return-1
ifa < b
,0
ifa = b
, or+1
ifa > b
. The result is undefined if eithera
orb
is anNaN
(not a number) value.END LongReal.