From 84cdeef45c26eb06b72e76e2ae8e078111e5e386 Mon Sep 17 00:00:00 2001 From: martynas Date: Tue, 29 Jul 2008 22:08:43 +0000 Subject: [PATCH] - add man pages for nan and remainder, from freebsd - mlink drem, dremf, remainderf to remainder; nanf to nan - describe that drem and dremf are obsolete aliases - remove descriptions for remainder and remainderf from ieee looked over by jmc@, but it's easier for him to work on when they are in tree --- lib/libm/Makefile | 15 ++-- lib/libm/man/ieee.3 | 59 +-------------- lib/libm/man/nan.3 | 95 ++++++++++++++++++++++++ lib/libm/man/remainder.3 | 153 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 257 insertions(+), 65 deletions(-) create mode 100644 lib/libm/man/nan.3 create mode 100644 lib/libm/man/remainder.3 diff --git a/lib/libm/Makefile b/lib/libm/Makefile index 4e1469b3f8a..7554d024556 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.51 2008/07/29 21:57:13 martynas Exp $ +# $OpenBSD: Makefile,v 1.52 2008/07/29 22:08:43 martynas Exp $ # # @(#)Makefile 5.1beta 93/09/24 # @@ -166,21 +166,21 @@ SRCS= ${COMMON_SRCS} MAN+= acos.3 acosh.3 asin.3 asinh.3 atan.3 atan2.3 atanh.3 ceil.3 \ cos.3 cosh.3 erf.3 exp.3 fabs.3 floor.3 fmod.3 hypot.3 ieee.3 \ - logb.3 j0.3 lgamma.3 lrint.3 lround.3 math.3 rint.3 round.3 \ - sin.3 sinh.3 sqrt.3 tan.3 tanh.3 trunc.3 + logb.3 j0.3 lgamma.3 lrint.3 lround.3 math.3 nan.3 remainder.3 \ + rint.3 round.3 sin.3 sinh.3 sqrt.3 tan.3 tanh.3 trunc.3 MLINKS+=erf.3 erfc.3 MLINKS+=exp.3 exp2.3 exp.3 expm1.3 exp.3 log.3 exp.3 log10.3 exp.3 log1p.3 \ exp.3 pow.3 MLINKS+=hypot.3 cabs.3 -MLINKS+=ieee.3 copysign.3 ieee.3 drem.3 ieee.3 ilogb.3 ieee.3 nextafter.3 \ - ieee.3 remainder.3 ieee.3 scalbn.3 +MLINKS+=ieee.3 copysign.3 ieee.3 ilogb.3 ieee.3 nextafter.3 ieee.3 scalbn.3 MLINKS+=logb.3 scalb.3 MLINKS+=logb.3 significand.3 MLINKS+=j0.3 j1.3 j0.3 jn.3 j0.3 y0.3 j0.3 y1.3 j0.3 yn.3 MLINKS+=lgamma.3 gamma.3 lgamma.3 tgamma.3 MLINKS+=lrint.3 llrint.3 MLINKS+=lround.3 llround.3 +MLINKS+=remainder.3 drem.3 remainder.3 remquo.3 MLINKS+=sqrt.3 cbrt.3 # float versions @@ -209,11 +209,9 @@ MLINKS+=fmod.3 fmodf.3 MLINKS+=hypot.3 cabsf.3 MLINKS+=hypot.3 hypotf.3 MLINKS+=ieee.3 copysignf.3 -MLINKS+=ieee.3 dremf.3 MLINKS+=ieee.3 ieeef.3 MLINKS+=ieee.3 ilogbf.3 MLINKS+=ieee.3 nextafterf.3 -MLINKS+=ieee.3 remainderf.3 MLINKS+=ieee.3 scalbnf.3 MLINKS+=j0.3 j0f.3 MLINKS+=j0.3 j1f.3 @@ -232,6 +230,9 @@ MLINKS+=lrint.3 llrintf.3 MLINKS+=lround.3 lroundf.3 MLINKS+=lround.3 llroundf.3 MLINKS+=math.3 mathf.3 +MLINKS+=nan.3 nanf.3 +MLINKS+=remainder.3 dremf.3 +MLINKS+=remainder.3 remainderf.3 MLINKS+=rint.3 rintf.3 MLINKS+=round.3 roundf.3 MLINKS+=sin.3 sinf.3 diff --git a/lib/libm/man/ieee.3 b/lib/libm/man/ieee.3 index 7219a34662d..3b8219dd38d 100644 --- a/lib/libm/man/ieee.3 +++ b/lib/libm/man/ieee.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ieee.3,v 1.15 2008/07/29 18:38:21 martynas Exp $ +.\" $OpenBSD: ieee.3,v 1.16 2008/07/29 22:08:43 martynas Exp $ .\" Copyright (c) 1985, 1991 Regents of the University of California. .\" All rights reserved. .\" @@ -38,8 +38,6 @@ .Nm ilogbf , .Nm nextafter , .Nm nextafterf , -.Nm remainder , -.Nm remainderf , .Nm scalbn , .Nm scalbnf .Nd functions for IEEE arithmetic @@ -58,10 +56,6 @@ .Ft float .Fn nextafterf "float x" "float y" .Ft double -.Fn remainder "double x" "double y" -.Ft float -.Fn remainderf "float x" "float y" -.Ft double .Fn scalbn "double x" "int n" .Ft float .Fn scalbnf "float x" "int n" @@ -106,48 +100,6 @@ The function is a single precision version of .Fn nextafter . .Pp -.Fn remainder -returns the remainder -.Fa r -:= -.Fa x -\- -.Fa n\(**y -where -.Fa n -is the integer nearest the exact value of -.Bk -words -.Fa x Ns / Ns Fa y ; -.Ek -moreover if -.Pf \\*(Ba Fa n -\- -.Sm off -.Fa x No / Fa y No \\*(Ba -.Sm on -= -1/2 -then -.Fa n -is even. -Consequently, the remainder is computed exactly and -.Sm off -.Pf \\*(Ba Fa r No \\*(Ba -.Sm on -\*(Le -.Sm off -.Pf \\*(Ba Fa y No \\*(Ba/2. -.Sm on -But -.Fn remainder x 0 -and -.Fn remainder \*(If 0 -are invalid operations that produce a \*(Na. -The -.Fn remainderf -function is a single precision version of -.Fn remainder . -.Pp .Fn scalbn returns .Fa x Ns \(**(2** Ns Fa n ) @@ -160,15 +112,6 @@ function is a single precision version of .Xr math 3 .Sh STANDARDS .St -ieee754 -.Pp -.Fn drem -and -.Fn dremf -are deprecated aliases for -.Fn remainder -and -.Fn remainderf , -respectively. .Sh HISTORY The .Nm ieee diff --git a/lib/libm/man/nan.3 b/lib/libm/man/nan.3 new file mode 100644 index 00000000000..cddd0cbade2 --- /dev/null +++ b/lib/libm/man/nan.3 @@ -0,0 +1,95 @@ +.\" $OpenBSD: nan.3,v 1.1 2008/07/29 22:08:43 martynas Exp $ +.\" +.\" Copyright (c) 2007 David Schultz +.\" 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. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. +.\" +.\" $FreeBSD: src/lib/msun/man/nan.3,v 1.1 2007/12/16 21:19:28 das Exp $ +.\" +.Dd $Mdocdate: July 29 2008 $ +.Dt NAN 3 +.Os +.Sh NAME +.Nm nan , +.Nm nanf +.Nd quiet \*(Nas +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft double +.Fn nan "const char *s" +.Ft float +.Fn nanf "const char *s" +.Sh DESCRIPTION +The +.Dv NAN +macro expands to a quiet \*(Na (Not A Number). +Similarly, each of the +.Fn nan , +and +.Fn nanf +functions generate a quiet \*(Na value without raising an invalid exception. +The argument +.Fa s +should point to either an empty string or a hexadecimal representation +of a non-negative integer (e.g., "0x1234".) +In the latter case, the integer is encoded in some free bits in the +representation of the \*(Na, which sometimes store +machine-specific information about why a particular \*(Na was generated. +There are 22 such bits available for +.Vt float +variables, 51 bits for +.Vt double +variables, and at least 51 bits for a +.Vt long double . +If +.Fa s +is improperly formatted or represents an integer that is too large, +then the particular encoding of the quiet \*(Na that is returned +is indeterminate. +.Sh COMPATIBILITY +Calling these functions with a non-empty string isn't portable. +Another operating system may translate the string into a different +\*(Na encoding, and furthermore, the meaning of a given \*(Na encoding +varies across machine architectures. +If you understood the innards of a particular platform well enough to +know what string to use, then you would have no need for these functions +anyway, so don't use them. +Use the +.Dv NAN +macro instead. +.Sh SEE ALSO +.Xr ieee 3 , +.Xr isnan 3 , +.Xr math 3 , +.Xr strtod 3 +.Sh STANDARDS +The +.Fn nan , +and +.Fn nanf +functions and the +.Dv NAN +macro conform to +.St -isoC-99 . diff --git a/lib/libm/man/remainder.3 b/lib/libm/man/remainder.3 new file mode 100644 index 00000000000..703cfe2c99c --- /dev/null +++ b/lib/libm/man/remainder.3 @@ -0,0 +1,153 @@ +.\" $OpenBSD: remainder.3,v 1.1 2008/07/29 22:08:43 martynas Exp $ +.\" +.\" Copyright (c) 1985, 1991 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. +.\" 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. +.\" +.\" from: @(#)ieee.3 6.4 (Berkeley) 5/6/91 +.\" $FreeBSD: src/lib/msun/man/remainder.3,v 1.6 2008/03/30 20:48:02 das Exp $ +.\" +.Dd $Mdocdate: July 29 2008 $ +.Dt REMAINDER 3 +.Os +.Sh NAME +.Nm remainder , +.Nm remainderf , +.Nm remquo , +.Nm remquof +.Nd minimal residue functions +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft double +.Fn remainder "double x" "double y" +.Ft float +.Fn remainderf "float x" "float y" +.Ft double +.Fn remquo "double x" "double y" "int *quo" +.Ft float +.Fn remquof "float x" "float y" "int *quo" +.Sh DESCRIPTION +.Fn remainder , +.Fn remainderf , +.Fn remquo , +and +.Fn remquof +return the remainder +.Fa r +:= +.Fa x +\- +.Fa n\(**y +where +.Fa n +is the integer nearest the exact value of +.Bk -words +.Fa x Ns / Ns Fa y ; +.Ek +moreover if +.Pf \\*(Ba Fa n +\- +.Sm off +.Fa x No / Fa y No \\*(Ba +.Sm on += +1/2 +then +.Fa n +is even. +Consequently +the remainder is computed exactly and +.Sm off +.Pf \\*(Ba Fa r No \\*(Ba +.Sm on +\*(Le +.Sm off +.Pf \\*(Ba Fa y No \\*(Ba/2 . +.Sm on +But attempting to take the remainder when +.Fa y +is 0 or +.Fa x +is \*(Pm\*(If is an invalid operation that produces a \*(Na. +.Pp +The +.Fn remquo , +and +.Fn remquof +functions also store the last +.Va k +bits of +.Fa n +in the location pointed to by +.Fa quo , +provided that +.Fa n +exists. +The number of bits +.Va k +is platform-specific, but is guaranteed to be at least 3. +.Sh SEE ALSO +.Xr fmod 3 , +.Xr ieee 3 , +.Xr math 3 +.Sh STANDARDS +The +.Fn remainder , +.Fn remainderf , +.Fn remquo , +and +.Fn remquof +routines conform to +.St -isoC-99 . +The remainder is as defined in +.St -ieee754 . +.Pp +.Fn drem +and +.Fn dremf +are deprecated aliases for +.Fn remainder +and +.Fn remainderf , +respectively. +.Sh HISTORY +The +.Fn remainder +and +.Fn remainderf +functions appeared in +.Bx 4.3 +and +.Nx 1.2 , +respectively. +The +.Fn remquo +and +.Fn remquof +functions were added in +.Ox 4.4 . -- 2.20.1