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 $
34 .\" $DragonFly: src/lib/libm/common_source/Attic/infnan.3,v 1.2 2003/06/17 04:26:50 dillon Exp $
41 .Nd signals invalid floating\-point operations on a
51 At some time in the future, some of the useful properties of
52 the Infinities and \*(Nas in the
54 standard 754 for Binary
55 Floating\-Point Arithmetic will be simulated in
59 by using its Reserved Operands. Meanwhile, the
60 Invalid, Overflow and Divide\-by\-Zero exceptions of the
62 standard are being approximated on a
67 in appropriate places in
70 better exception\-handling is implemented in
76 will have to be changed.
82 insulate themselves from future changes.
84 Whenever an elementary function code in
87 simulate one of the aforementioned
91 with an appropriate value of
94 reserved operand fault stops computation. But
97 be replaced by a function with the same name that returns
98 some plausible value, assigns an apt value to the global
101 and allows computation to resume.
102 Alternatively, the Reserved Operand Fault Handler could be
103 changed to respond by returning that plausible value, etc.\&
106 In the table below, the first two columns show various
107 exceptions signaled by the
109 standard, and the default
110 result it prescribes. The third column shows what value is
118 under analogous circumstances on a
122 stops computation under all those
123 circumstances. The last two columns offer an alternative;
124 they suggest a setting for
129 to return. And a C program to
130 implement that suggestion follows.
131 .Bl -column "IEEE Signal" "IEEE Default" XXERANGE ERANGEXXorXXEDOM
132 .It "IEEE Signal IEEE Default " Fa iarg Ta Va errno Ta Fn infnan
133 .It "Invalid \*(Na " Er "EDOM EDOM 0"
134 .It "Overflow \(+-\*(If " Er "ERANGE ERANGE" Ta Dv HUGE
135 .It "Div\-by\-0 \(+-Infinity " Er "\(+-ERANGE ERANGE or EDOM" Ta Dv \(+-HUGE
137 .Bd -ragged -offset center -compact
139 = 1.7e38 ... nearly 2.0**127)
144 .Bd -literal -offset indent
152 case \0ERANGE: errno = ERANGE; return(HUGE);
153 case \-ERANGE: errno = EDOM; return(\-HUGE);
154 default: errno = EDOM; return(0);