summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2009-10-26 21:06:20 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2009-10-26 21:06:20 +0000
commitc587c3cacb40384b8d4d6983eb1eb5f2991b630c (patch)
tree8b86702bd245c4133fc58ee7873c827a2bafcefc
parent3594e2b768f3b3233b130df338e157fcdb5deac0 (diff)
Add man pages for the fdim/fmin/fmax family of functions and make sure fdiml
is defined on all architectures. ok jmc@ (man pages) and martynas@
-rw-r--r--lib/libm/Makefile11
-rw-r--r--lib/libm/man/fdim.386
-rw-r--r--lib/libm/man/fmax.397
-rw-r--r--lib/libm/shlib_version2
-rw-r--r--lib/libm/src/s_fdim.c9
5 files changed, 195 insertions, 10 deletions
diff --git a/lib/libm/Makefile b/lib/libm/Makefile
index 3b810a5ff39..3e987580f9b 100644
--- a/lib/libm/Makefile
+++ b/lib/libm/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.71 2009/10/24 10:06:02 jmc Exp $
+# $OpenBSD: Makefile,v 1.72 2009/10/26 21:06:19 kettenis Exp $
# $NetBSD: Makefile,v 1.28 1995/11/20 22:06:19 jtc Exp $
#
# @(#)Makefile 5.1beta 93/09/24
@@ -163,7 +163,7 @@ SRCS+= ${LONG_SRCS}
.endif
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 \
+ cos.3 cosh.3 erf.3 exp.3 fabs.3 fdim.3 floor.3 fmax.3 fmod.3 hypot.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 \
copysign.3 ilogb.3 nextafter.3 scalbn.3
@@ -171,6 +171,7 @@ MAN+= acos.3 acosh.3 asin.3 asinh.3 atan.3 atan2.3 atanh.3 ceil.3 \
MLINKS+=erf.3 erfc.3
MLINKS+=exp.3 exp2.3 exp.3 expm1.3 exp.3 log.3 exp.3 log2.3 \
exp.3 log10.3 exp.3 log1p.3 exp.3 pow.3
+MLINKS+=fmax.3 fmin.3
MLINKS+=hypot.3 cabs.3
MLINKS+=scalbn.3 scalbln.3
MLINKS+=logb.3 scalb.3
@@ -204,7 +205,10 @@ MLINKS+=exp.3 log2f.3
MLINKS+=exp.3 logf.3
MLINKS+=exp.3 powf.3
MLINKS+=fabs.3 fabsf.3
+MLINKS+=fdim.3 fdimf.3
MLINKS+=floor.3 floorf.3
+MLINKS+=fmax.3 fmaxf.3
+MLINKS+=fmax.3 fminf.3
MLINKS+=fmod.3 fmodf.3
MLINKS+=hypot.3 cabsf.3
MLINKS+=hypot.3 hypotf.3
@@ -252,6 +256,9 @@ MLINKS+=atan2.3 atan2l.3
MLINKS+=cos.3 cosl.3
MLINKS+=exp.3 exp2l.3
MLINKS+=fabs.3 fabsl.3
+MLINKS+=fdim.3 fdiml.3
+MLINKS+=fmax.3 fmaxl.3
+MLINKS+=fmax.3 fminl.3
MLINKS+=copysign.3 copysignl.3
MLINKS+=ilogb.3 ilogbl.3
MLINKS+=scalbn.3 scalbnl.3
diff --git a/lib/libm/man/fdim.3 b/lib/libm/man/fdim.3
new file mode 100644
index 00000000000..45d164bccf2
--- /dev/null
+++ b/lib/libm/man/fdim.3
@@ -0,0 +1,86 @@
+.\" $OpenBSD: fdim.3,v 1.1 2009/10/26 21:06:19 kettenis Exp $
+.\"
+.\" Copyright (c) 2004 David Schultz <das@FreeBSD.org>
+.\" 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/fdim.3,v 1.1 2004/06/30 07:04:01 das Exp $
+.\"
+.Dd $Mdocdate: October 26 2009 $
+.Dt FDIM 3
+.Os
+.Sh NAME
+.Nm fdim ,
+.Nm fdimf ,
+.Nm fdiml
+.Nd positive difference functions
+.Sh SYNOPSIS
+.In math.h
+.Ft double
+.Fn fdim "double x" "double y"
+.Ft float
+.Fn fdimf "float x" "float y"
+.Ft long double
+.Fn fdiml "long double x" "long double y"
+.Sh DESCRIPTION
+The
+.Fn fdim ,
+.Fn fdimf ,
+and
+.Fn fdiml
+functions return the positive difference between
+.Fa x
+and
+.Fa y .
+That is, if
+.Fa x\- Ns Fa y
+is positive, then
+.Fa x\- Ns Fa y
+is returned.
+If either
+.Fa x
+or
+.Fa y
+is an \*(Na, then an \*(Na is returned.
+Otherwise, the result is
+.Li +0.0 .
+.Pp
+Overflow or underflow may occur if the exact result is not
+representable in the return type.
+No other exceptions are raised.
+.Sh SEE ALSO
+.Xr fabs 3 ,
+.Xr fmax 3 ,
+.Xr fmin 3 ,
+.Xr math 3
+.Sh STANDARDS
+The
+.Fn fdim ,
+.Fn fdimf ,
+and
+.Fn fdiml
+functions conform to
+.St -isoC-99 .
+.Sh HISTORY
+These routines first appeared in
+.Ox 4.5 .
diff --git a/lib/libm/man/fmax.3 b/lib/libm/man/fmax.3
new file mode 100644
index 00000000000..c6d639a0276
--- /dev/null
+++ b/lib/libm/man/fmax.3
@@ -0,0 +1,97 @@
+.\" $OpenBSD: fmax.3,v 1.1 2009/10/26 21:06:19 kettenis Exp $
+.\"
+.\" Copyright (c) 2004 David Schultz <das@FreeBSD.org>
+.\" 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/fmax.3,v 1.2 2005/01/14 09:12:05 ru Exp $
+.\"
+.Dd $Mdocdate: October 26 2009 $
+.Dt FMAX 3
+.Os
+.Sh NAME
+.Nm fmax ,
+.Nm fmaxf ,
+.Nm fmaxl ,
+.Nm fmin ,
+.Nm fminf ,
+.Nm fminl
+.Nd floating-point maximum and minimum functions
+.Sh SYNOPSIS
+.In math.h
+.Ft double
+.Fn fmax "double x" "double y"
+.Ft float
+.Fn fmaxf "float x" "float y"
+.Ft "long double"
+.Fn fmaxl "long double x" "long double y"
+.Ft double
+.Fn fmin "double x" "double y"
+.Ft float
+.Fn fminf "float x" "float y"
+.Ft "long double"
+.Fn fminl "long double x" "long double y"
+.Sh DESCRIPTION
+The
+.Fn fmax ,
+.Fn fmaxf ,
+and
+.Fn fmaxl
+functions return the larger of
+.Fa x
+and
+.Fa y ,
+and likewise the
+.Fn fmin ,
+.Fn fminf ,
+and
+.Fn fminl
+functions return the smaller of
+.Fa x
+and
+.Fa y .
+They treat
+.Li +0.0
+as being larger than
+.Li -0.0 .
+If one argument is an \*(Na, then the other argument is returned.
+If both arguments are \*(Nas, then the result is an \*(Na.
+These routines do not raise any floating-point exceptions.
+.Sh SEE ALSO
+.Xr fabs 3 ,
+.Xr fdim 3 ,
+.Xr math 3
+.Sh STANDARDS
+The
+.Fn fmax ,
+.Fn fmaxf ,
+.Fn fmaxl ,
+.Fn fmin ,
+.Fn fminf ,
+and
+.Fn fminl
+functions conform to
+.St -isoC-99 .
+.Sh HISTORY
+These routines first appeared in
+.Ox 4.5 .
diff --git a/lib/libm/shlib_version b/lib/libm/shlib_version
index 900b4048a96..715ca914844 100644
--- a/lib/libm/shlib_version
+++ b/lib/libm/shlib_version
@@ -1,2 +1,2 @@
major=5
-minor=1
+minor=2
diff --git a/lib/libm/src/s_fdim.c b/lib/libm/src/s_fdim.c
index 4ce219448f7..12fb1382462 100644
--- a/lib/libm/src/s_fdim.c
+++ b/lib/libm/src/s_fdim.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: s_fdim.c,v 1.3 2008/12/10 01:08:24 martynas Exp $ */
+/* $OpenBSD: s_fdim.c,v 1.4 2009/10/26 21:06:19 kettenis Exp $ */
/*-
* Copyright (c) 2004 David Schultz <das@FreeBSD.ORG>
* All rights reserved.
@@ -43,9 +43,4 @@ fn(type x, type y) \
DECL(double, fdim)
DECL(float, fdimf)
-
-#if LDBL_MANT_DIG == 53
-#ifdef __weak_alias
-__weak_alias(fdiml, fdim);
-#endif /* __weak_alias */
-#endif /* LDBL_MANT_DIG == 53 */
+DECL(long double, fdiml)