# Real, LongReal, and Extended

For definitions of the terms used in the floating-point interfaces, see the ANSI/IEEE Standard 754-1985, IEEE Standard for Binary Floating-Point Arithmetic. floating-point IEEE floating-point

The interfaces `Real`, `LongReal`, and `Extended` define constant attributes of the three built-in floating-point types: floating-point representation

    INTERFACE Real; TYPE T = REAL;
    CONST
      Base: INTEGER = ...;
      Precision: INTEGER = ...;
      MaxFinite: T = ...;
      MinPos: T = ...;
      MinPosNormal: T = ...;
      MaxExpDigits: INTEGER = ...;
      MaxSignifDigits: INTEGER = ...;
    END Real.

    INTERFACE LongReal; TYPE T = LONGREAL;
    CONST
      Base: INTEGER = ...;
      Precision: INTEGER = ...;
      MaxFinite: T = ...;
      MinPos: T = ...;
      MinPosNormal: T = ...;
      MaxExpDigits: INTEGER = ...;
      MaxSignifDigits: INTEGER = ...;
    END LongReal.

    INTERFACE Extended; TYPE T = EXTENDED;
    CONST
      Base: INTEGER = ...;
      Precision: INTEGER = ...;
      MaxFinite: T = ...;
      MinPos: T = ...;
      MinPosNormal: T = ...;
      MaxExpDigits: INTEGER = ...;
      MaxSignifDigits: INTEGER = ...;
    END Extended.

The specification is the same for all three interfaces:

> `Base` is the base of the floating-point representation for `T`.

> `Precision` is the number of base-`Base` digits of precision for `T`.

> `MaxFinite` is the maximum finite value in `T`. For non-IEEE implementations, this is the same as `LAST(T)`.

> `MinPos` is the minimum positive value in `T`.

> `MinPosNormal` is the minimum positive normal value in `T`; it differs from `MinPos` only for implementations (like IEEE) with denormalized numbers.

> `MaxExpDigits` is the smallest integer with the property that every finite number of type `T` can be written in base-10 scientific notation using an exponent with at most `MaxExpDigits`.

> `MaxSignifDigits` is the smallest integer with the property that for every point `x` along the number line, the two floating-decimal numbers with `MaxSignifDigits` closest to `x` are closer to each other than are the two closest numbers of type `T`.

Typically,

    MaxExpDigits    = CEILING(LOG_10(LOG_10(MaxFinite)))
    MaxSignifDigits = CEILING(LOG_10(Base EXP Precision)) + 1.