Oberon || Library || Module Index || Search Engine || Definition || Module


Ulm's Oberon Library:
IEEE


NAME

IEEE - support of IEEE floating point format

SYNOPSIS

VAR plusInfinity: REAL;
VAR minusInfinity: REAL;
VAR nan: REAL;
VAR snan: REAL;


PROCEDURE Normalized(real: LONGREAL) : BOOLEAN; PROCEDURE Valid(real: LONGREAL) : BOOLEAN; PROCEDURE NotANumber(real: LONGREAL) : BOOLEAN;

DESCRIPTION

This module is portable as far as an IEEE floating processor is present. The IEEE floating point format supports some special formats for infinity and undefined values. Operations with undefined values, so called not-a-numbers yield again undefined values. This allows to distinguish valid and reasonable results from undefined results (division by zero, ln(0), etc.). Valid numbers are either normalized or denormalized (small values beneath zero).

Following variables contain special formats:

plusInfinity	plus infinity
minusInfinity	minus infinity
nan		not-a-number (undefined	value)
snan		signaling not-a-number
The formats of not-a-numbers are not unique, thus NotANumber (see below) is needed to check a real value for being not-a-number. Signaling not-a-numbers are not generated by floating point operations. Operations with signaling not-a-numbers cause an event (UnixSignals.FPE) if the associated floating point exception is enabled. All variables are of type REAL and can be assigned to LONGREAL without losing their special format.

Normalized returns TRUE for normalized floating point numbers. Valid returns TRUE for normalized and denormalized real values but FALSE for infinity and not-a-numbers. NotANumber returns TRUE if real is a not-a-number (either signaling or not).

SEE ALSO

MC68881 for special operations of MC68881-compatible processors. MC68881.SetExceptionEnable allows to enable UnixSignals.FPE to be raised on operations with signaling not-a-numbers.
Edited by: borchert, last change: 1992/04/22, revision: 1.2, converted to HTML: 1997/04/28

Oberon || Library || Module Index || Search Engine || Definition || Module