1 .\" $OpenBSD: infnan.3,v 1.17 2015/01/15 19:06:31 schwarze Exp $
3 .\" Copyright (c) 1985, 1991, 1993
4 .\" The Regents of the University of California. All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
14 .\" 3. Neither the name of the University nor the names of its contributors
15 .\" may be used to endorse or promote products derived from this software
16 .\" without specific prior written permission.
18 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" @(#)infnan.3 8.1 (Berkeley) 6/4/93
32 .Dd $Mdocdate: January 15 2015 $
37 .Nd signals invalid floating\-point operations on a VAX (temporary)
43 At some time in the future, some of the useful properties of
44 the Infinities and \*(Nas in the IEEE standard 754
45 for Binary Floating\-Point Arithmetic will be simulated in UNIX
46 on the DEC VAX by using its Reserved Operands.
47 Meanwhile, the Invalid, Overflow and Divide\-by\-Zero exceptions of the
48 IEEE standard are being approximated on a VAX by calls to a procedure
50 in appropriate places in
52 When better exception\-handling is implemented in UNIX, only
56 will have to be changed.
62 insulate themselves from future changes.
64 Whenever an elementary function code in
67 simulate one of the aforementioned IEEE exceptions, it calls
69 with an appropriate value of
72 reserved operand fault stops computation.
76 be replaced by a function with the same name that returns
77 some plausible value, assigns an apt value to the global
80 and allows computation to resume.
81 Alternatively, the Reserved Operand Fault Handler could be
82 changed to respond by returning that plausible value, etc.,
85 In the table below, the first two columns show various exceptions
86 signaled by the IEEE standard, and the default result it prescribes.
87 The third column shows what value is given to
94 under analogous circumstances on a VAX.
97 stops computation under all those
99 The last two columns offer an alternative;
100 they suggest a setting for
106 And a C program to implement that suggestion follows.
107 .Bl -column "IEEE Signal" "IEEE Default" "+-ERANGE" "ERANGE/EDOM" "infnanXX"
108 .It Sy "IEEE Signal" Ta Sy "IEEE Default" Ta Fa iarg Ta Va errno Ta Fn infnan
109 .It Invalid Ta \*(Na Ta Dv EDOM Ta Dv EDOM Ta 0
110 .It Overflow Ta \(+-\*(If Ta Dv ERANGE Ta Dv ERANGE Ta Dv HUGE
111 .It Div\-by\-0 Ta \(+-\*(If Ta Dv +-ERANGE Ta Dv ERANGE/EDOM Ta Dv +-HUGE
114 .Dl ( Ns Dv HUGE No = 1.7e38 ... nearly 2.0**127)
118 .Bd -literal -offset indent