gm2-libs-iso/LowReal (The GNU Modula-2 Compiler)

#### 4.4.24 gm2-libs-iso/LowReal ¶

    DEFINITION MODULE LowReal;

      (* Access to underlying properties of the type REAL *)

    CONST
      radix      = __ATTRIBUTE__ __BUILTIN__ (( <REAL, radix> )) ;      (* ZType *)
      places     = __ATTRIBUTE__ __BUILTIN__ (( <REAL, places> )) ;     (* ZType *)
      expoMin    = __ATTRIBUTE__ __BUILTIN__ (( <REAL, expoMin> )) ;    (* ZType *)
      expoMax    = __ATTRIBUTE__ __BUILTIN__ (( <REAL, expoMax> )) ;    (* ZType *)
      large      = __ATTRIBUTE__ __BUILTIN__ (( <REAL, large> )) ;      (* RType *)
      small      = __ATTRIBUTE__ __BUILTIN__ (( <REAL, small> )) ;      (* RType *)
      IEC559     = __ATTRIBUTE__ __BUILTIN__ (( <REAL, IEC559> )) ;     (* BOOLEAN *)
      LIA1       = __ATTRIBUTE__ __BUILTIN__ (( <REAL, LIA1> )) ;       (* BOOLEAN *)
      ISO        = __ATTRIBUTE__ __BUILTIN__ (( <REAL, ISO> )) ;        (* BOOLEAN *)
      IEEE       = __ATTRIBUTE__ __BUILTIN__ (( <REAL, IEEE> )) ;       (* BOOLEAN *)
      rounds     = __ATTRIBUTE__ __BUILTIN__ (( <REAL, rounds> )) ;     (* BOOLEAN *)
      gUnderflow = __ATTRIBUTE__ __BUILTIN__ (( <REAL, gUnderflow> )) ; (* BOOLEAN *)
      exception  = __ATTRIBUTE__ __BUILTIN__ (( <REAL, exception> )) ;  (* BOOLEAN *)
      extend     = __ATTRIBUTE__ __BUILTIN__ (( <REAL, extend> )) ;     (* BOOLEAN *)
      nModes     = __ATTRIBUTE__ __BUILTIN__ (( <REAL, nModes> )) ;     (* ZType *)

    TYPE
      Modes = PACKEDSET OF [0..nModes-1];

    PROCEDURE exponent (x: REAL): INTEGER;
      (* Returns the exponent value of x *)

    PROCEDURE fraction (x: REAL): REAL;
      (* Returns the significand (or significant part) of x *)

    PROCEDURE sign (x: REAL): REAL;
      (* Returns the signum of x *)

    PROCEDURE succ (x: REAL): REAL;
      (* Returns the next value of the type REAL greater than x *)

    PROCEDURE ulp (x: REAL): REAL;
      (* Returns the value of a unit in the last place of x *)

    PROCEDURE pred (x: REAL): REAL;
      (* Returns the previous value of the type REAL less than x *)

    PROCEDURE intpart (x: REAL): REAL;
      (* Returns the integer part of x *)

    PROCEDURE fractpart (x: REAL): REAL;
      (* Returns the fractional part of x *)

    PROCEDURE scale (x: REAL; n: INTEGER): REAL;
      (* Returns the value of x * radix ** n *)

    PROCEDURE trunc (x: REAL; n: INTEGER): REAL;
      (* Returns the value of the first n places of x *)

    PROCEDURE round (x: REAL; n: INTEGER): REAL;
      (* Returns the value of x rounded to the first n places *)

    PROCEDURE synthesize (expart: INTEGER; frapart: REAL): REAL;
      (* Returns a value of the type REAL constructed from the given expart and frapart *)

    PROCEDURE setMode (m: Modes);
      (* Sets status flags appropriate to the underlying implementation of the type REAL *)

    PROCEDURE currentMode (): Modes;
      (* Returns the current status flags in the form set by setMode *)

    PROCEDURE IsLowException (): BOOLEAN;
      (* Returns TRUE if the current coroutine is in the exceptional execution state
         because of the raising of an exception in a routine from this module; otherwise
         returns FALSE.
      *)

    END LowReal.