1 .\" Copyright (c) 1985, 1991, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\" must display the following acknowledgement:
14 .\" This product includes software developed by the University of
15 .\" California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .\" @(#)infnan.3 8.1 (Berkeley) 6/4/93
33 .\" $FreeBSD: src/lib/libm/common_source/infnan.3,v 1.4.2.6 2001/12/17 10:08:31 ru Exp $
40 .Nd signals invalid floating\-point operations on a
50 At some time in the future, some of the useful properties of
51 the Infinities and \*(Nas in the
53 standard 754 for Binary
54 Floating\-Point Arithmetic will be simulated in
58 by using its Reserved Operands. Meanwhile, the
59 Invalid, Overflow and Divide\-by\-Zero exceptions of the
61 standard are being approximated on a
66 in appropriate places in
69 better exception\-handling is implemented in
75 will have to be changed.
81 insulate themselves from future changes.
83 Whenever an elementary function code in
86 simulate one of the aforementioned
90 with an appropriate value of
93 reserved operand fault stops computation. But
96 be replaced by a function with the same name that returns
97 some plausible value, assigns an apt value to the global
100 and allows computation to resume.
101 Alternatively, the Reserved Operand Fault Handler could be
102 changed to respond by returning that plausible value, etc.\&
105 In the table below, the first two columns show various
106 exceptions signaled by the
108 standard, and the default
109 result it prescribes. The third column shows what value is
117 under analogous circumstances on a
121 stops computation under all those
122 circumstances. The last two columns offer an alternative;
123 they suggest a setting for
128 to return. And a C program to
129 implement that suggestion follows.
130 .Bl -column "IEEE Signal" "IEEE Default" XXERANGE ERANGEXXorXXEDOM
131 .It "IEEE Signal IEEE Default " Fa iarg Ta Va errno Ta Fn infnan
132 .It "Invalid \*(Na " Er "EDOM EDOM 0"
133 .It "Overflow \(+-\*(If " Er "ERANGE ERANGE" Ta Dv HUGE
134 .It "Div\-by\-0 \(+-Infinity " Er "\(+-ERANGE ERANGE or EDOM" Ta Dv \(+-HUGE
136 .Bd -ragged -offset center -compact
138 = 1.7e38 ... nearly 2.0**127)
143 .Bd -literal -offset indent
151 case \0ERANGE: errno = ERANGE; return(HUGE);
152 case \-ERANGE: errno = EDOM; return(\-HUGE);
153 default: errno = EDOM; return(0);