.\" Copyright (c) 1985, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.\" %sccs.include.redist.man%
.\" @(#)infnan.3 8.1 (Berkeley) %G%
.Nd signals invalid floating\-point operations on a
At some time in the future, some of the useful properties of
the Infinities and \*(Nas in the
Floating\-Point Arithmetic will be simulated in
by using its Reserved Operands. Meanwhile, the
Invalid, Overflow and Divide\-by\-Zero exceptions of the
standard are being approximated on a
better exception\-handling is implemented in
insulate themselves from future changes.
Whenever an elementary function code in
simulate one of the aforementioned
with an appropriate value of
reserved operand fault stops computation. But
be replaced by a function with the same name that returns
some plausible value, assigns an apt value to the global
and allows computation to resume.
Alternatively, the Reserved Operand Fault Handler could be
changed to respond by returning that plausible value, etc.
In the table below, the first two columns show various
exceptions signaled by the
standard, and the default
result it prescribes. The third column shows what value is
under analogous circumstances on a
stops computation under all those
circumstances. The last two columns offer an alternative;
they suggest a setting for
to return. And a C program to
implement that suggestion follows.
.Bd -filled -offset indent
.Bl -column "IEEE Signal" "IEEE Default" XXERANGE ERANGEXXorXXEDOM
.It IEEE Signal IEEE Default Ta
.It Overflow \(+-\*(If Ta
.It Div\-by\-0 \(+-Infinity Ta
.Dv \(+-ERANGE ERANGE or EDOM \(+-HUGE
.It ( Ns Dv HUGE No "= 1.7e38 ... nearly 2.0**127)"
.Bd -literal -offset indent
case \0ERANGE: errno = ERANGE; return(HUGE);
case \-ERANGE: errno = EDOM; return(\-HUGE);
default: errno = EDOM; return(0);