diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 1997-09-01 02:13:14 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 1997-09-01 02:13:14 +0000 |
commit | fd34f721763470ce8f5bd60862610862b508bd0c (patch) | |
tree | 6ab193d8c5acaf1d14d751abb07c0261160faefd /lib | |
parent | f4bf14ace20658c514f57618dc2b96e65960d0f8 (diff) |
missing VAX manual for infnan(3), from 4.4 BSD
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libm/Makefile | 3 | ||||
-rw-r--r-- | lib/libm/man/infnan.3 | 182 |
2 files changed, 184 insertions, 1 deletions
diff --git a/lib/libm/Makefile b/lib/libm/Makefile index c4662314aa8..db35e854131 100644 --- a/lib/libm/Makefile +++ b/lib/libm/Makefile @@ -1,5 +1,5 @@ # $NetBSD: Makefile,v 1.28 1995/11/20 22:06:19 jtc Exp $ -# $OpenBSD: Makefile,v 1.10 1997/03/25 17:07:33 rahnds Exp $ +# $OpenBSD: Makefile,v 1.11 1997/09/01 02:13:12 mickey Exp $ # # @(#)Makefile 5.1beta 93/09/24 # @@ -62,6 +62,7 @@ ARCH_SRCS = e_acos.S e_asin.S e_atanh.S e_cosh.S e_exp.S e_log.S e_log10.S \ .PATH: ${.CURDIR}/arch/vax NOIEEE_ARCH=n_infnan.S n_argred.S n_sqrt.S ARCH_SRCS = n_atan2.S n_cabs.S n_cbrt.S n_sincos.S n_tan.S n_support.S +MAN+=infnan.3 .endif .if (${MACHINE_ARCH} == "mvme88k") diff --git a/lib/libm/man/infnan.3 b/lib/libm/man/infnan.3 new file mode 100644 index 00000000000..a27eee52c29 --- /dev/null +++ b/lib/libm/man/infnan.3 @@ -0,0 +1,182 @@ +.\" $OpenBSD: infnan.3,v 1.1 1997/09/01 02:13:13 mickey Exp $ +.\" +.\" Copyright (c) 1985, 1991, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)infnan.3 8.1 (Berkeley) 6/4/93 +.\" +.Dd June 4, 1993 +.Dt INFNAN 3 vax +.Os +.Sh NAME +.Nm infnan +.Nd signals invalid floating\-point operations on a +.Tn VAX +(temporary) +.Sh SYNOPSIS +.Fd #include <math.h> +.Ft double +.Fn infnan "int iarg" +.Sh DESCRIPTION +At some time in the future, some of the useful properties of +the Infinities and \*(Nas in the +.Tn IEEE +standard 754 for Binary +Floating\-Point Arithmetic will be simulated in +.Tn UNIX +on the +.Tn DEC VAX +by using its Reserved Operands. Meanwhile, the +Invalid, Overflow and Divide\-by\-Zero exceptions of the +.Tn IEEE +standard are being approximated on a +.Tn VAX +by calls to a +procedure +.Fn infnan +in appropriate places in +.Xr libm 3 . +When +better exception\-handling is implemented in +.Tn UNIX , +only +.Fn infnan +among the codes in +.Xr libm +will have to be changed. +And users of +.Xr libm +can design their own +.Fn infnan +now to +insulate themselves from future changes. +.Pp +Whenever an elementary function code in +.Xr libm +has to +simulate one of the aforementioned +.Tn IEEE +exceptions, it calls +.Fn infnan iarg +with an appropriate value of +.Fa iarg . +Then a +reserved operand fault stops computation. But +.Fn infnan +could +be replaced by a function with the same name that returns +some plausible value, assigns an apt value to the global +variable +.Va errno , +and allows computation to resume. +Alternatively, the Reserved Operand Fault Handler could be +changed to respond by returning that plausible value, etc. +instead of aborting. +.Pp +In the table below, the first two columns show various +exceptions signaled by the +.Tn IEEE +standard, and the default +result it prescribes. The third column shows what value is +given to +.Fa iarg +by functions in +.Xr libm +when they +invoke +.Fn infnan iarg +under analogous circumstances on a +.Tn VAX . +Currently +.Fn infnan +stops computation under all those +circumstances. The last two columns offer an alternative; +they suggest a setting for +.Va errno +and a value for a +revised +.Fn infnan +to return. And a C program to +implement that suggestion follows. +.sp 0.5 +.Bd -filled -offset indent +.Bl -column "IEEE Signal" "IEEE Default" XXERANGE ERANGEXXorXXEDOM +.It IEEE Signal IEEE Default Ta +.Fa iarg Ta +.Va errno Ta +.Fn infnan +.It Invalid \*(Na Ta +.Dv EDOM EDOM 0 +.It Overflow \(+-\*(If Ta +.Dv ERANGE ERANGE HUGE +.It Div\-by\-0 \(+-Infinity Ta +.Dv \(+-ERANGE ERANGE or EDOM \(+-HUGE +.It ( Ns Dv HUGE No "= 1.7e38 ... nearly 2.0**127)" +.El +.Ed +.Pp +ALTERNATIVE +.Fn infnan : +.Bd -literal -offset indent +#include <math.h> +#include <errno.h> +extern int errno ; +double infnan(iarg) +int iarg ; +{ + switch(iarg) { + case \0ERANGE: errno = ERANGE; return(HUGE); + case \-ERANGE: errno = EDOM; return(\-HUGE); + default: errno = EDOM; return(0); + } +} +.Ed +.Sh SEE ALSO +.Xr math 3 , +.Xr intro 2 , +.Xr signal 3 . +.Pp +.Dv ERANGE +and +.Dv EDOM +are defined in +.Aq Pa errno.h . +(See +.Xr intro 2 +for explanation of +.Dv EDOM +and +.Dv ERANGE . ) +.Sh HISTORY +The +.Fn infnan +function appeared in +.Bx 4.3 . |