Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libm Split out from ieee(3) also the remainder(3) and co...



details:   https://anonhg.NetBSD.org/src/rev/42c6a378cef3
branches:  trunk
changeset: 764170:42c6a378cef3
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Wed Apr 13 04:57:10 2011 +0000

description:
Split out from ieee(3) also the remainder(3) and copysign(3) families.

diffstat:

 lib/libm/Makefile        |   24 ++++--
 lib/libm/man/copysign.3  |   90 ++++++++++++++++++++++++++++
 lib/libm/man/ieee.3      |   80 +------------------------
 lib/libm/man/remainder.3 |  149 +++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 255 insertions(+), 88 deletions(-)

diffs (truncated from 436 to 300 lines):

diff -r eac1b9cd90ae -r 42c6a378cef3 lib/libm/Makefile
--- a/lib/libm/Makefile Wed Apr 13 03:40:00 2011 +0000
+++ b/lib/libm/Makefile Wed Apr 13 04:57:10 2011 +0000
@@ -1,4 +1,4 @@
-#  $NetBSD: Makefile,v 1.105 2011/04/12 07:29:50 jruoho Exp $
+#  $NetBSD: Makefile,v 1.106 2011/04/13 04:57:11 jruoho Exp $
 #
 #  @(#)Makefile 5.1beta 93/09/24
 #
@@ -200,11 +200,15 @@
 COPTS.s_tanh.c+= -O0
 .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 frexp.3 hypot.3 ieee.3 \
+MAN+=  acos.3 acosh.3 asin.3 asinh.3 atan.3 atan2.3 atanh.3 \
+       ceil.3 copysign.3 cos.3 cosh.3 \
+       erf.3 exp.3 \
+       fabs.3 floor.3 fmod.3 frexp.3 hypot.3 ieee.3 \
        ieee_test.3 isinff.3 j0.3 ldexp.3 lgamma.3 lrint.3 \
-       math.3 modf.3 nextafter.3 rint.3 round.3 sin.3 sinh.3 \
-       sqrt.3 tan.3 tanh.3 trunc.3 fmax.3 fdim.3
+       math.3 modf.3 nextafter.3 \
+       remainder.3 rint.3 round.3 \
+       sin.3 sinh.3 sqrt.3 \
+       tan.3 tanh.3 trunc.3 fmax.3 fdim.3
 
 # fenv.h interface
 MAN+=  feclearexcept.3 feenableexcept.3 fegetenv.3 fegetround.3 fenv.3
@@ -227,6 +231,8 @@
 MLINKS+=atan2.3 atan2f.3
 MLINKS+=atanh.3 atanhf.3
 MLINKS+=ceil.3 ceilf.3
+MLINKS+=copysign.3 copysignf.3 \
+       copysign.3 copysignl.3
 MLINKS+=cos.3 cosf.3
 MLINKS+=cosh.3 coshf.3
 MLINKS+=erf.3 erff.3 erf.3 erfc.3 erf.3 erfcf.3
@@ -241,11 +247,8 @@
 MLINKS+=floor.3 floorf.3
 MLINKS+=fmod.3 fmodf.3
 MLINKS+=hypot.3 hypotf.3
-MLINKS+=ieee.3 copysign.3 ieee.3 copysignf.3 ieee.3 copysignl.3        \
-       ieee.3 finite.3 ieee.3 finitef.3                                \
+MLINKS+=ieee.3 finite.3 ieee.3 finitef.3                               \
        ieee.3 ilogb.3 ieee.3 ilogbf.3                                  \
-       ieee.3 remainder.3 ieee.3 remainderf.3                          \
-       ieee.3 remquo.3 ieee.3 remquof.3                                \
        ieee.3 scalbn.3 ieee.3 scalbnf.3
 MLINKS+=ieee_test.3 logb.3 ieee_test.3 logbf.3
 MLINKS+=ieee_test.3 scalb.3 ieee_test.3 scalbf.3
@@ -260,6 +263,9 @@
        nextafter.3 nextafterl.3 \
        nextafter.3 nexttoward.3
 MLINKS+=lrint.3 lrintf.3 lrint.3 llrint.3 lrint.3 llrintf.3
+MLINKS+=remainder.3 remainderf.3 \
+       remainder.3 remquo.3 \
+       remainder.3 remquof.3
 MLINKS+=rint.3 rintf.3
 MLINKS+=sin.3 sinf.3
 MLINKS+=sinf.3 sinhf.3
diff -r eac1b9cd90ae -r 42c6a378cef3 lib/libm/man/copysign.3
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libm/man/copysign.3   Wed Apr 13 04:57:10 2011 +0000
@@ -0,0 +1,90 @@
+.\" $NetBSD: copysign.3,v 1.1 2011/04/13 04:57:10 jruoho Exp $
+.\"
+.\" Copyright (c) 2011 Jukka Ruohonen <jruohonen%iki.fi@localhost>
+.\" 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+.\"
+.Dd April 13, 2011
+.Dt COPYSIGN 3
+.Os
+.Sh NAME
+.Nm copysign ,
+.Nm copysignf ,
+.Nm copysignl
+.Nd functions to manipulate signs
+.Sh LIBRARY
+.Lb libm
+.Sh SYNOPSIS
+.In math.h
+.Ft double
+.Fn copysign "double x" "double y"
+.Ft float
+.Fn copysignf "float x" "float y"
+.Ft long double
+.Fn copysignl "long double x" "long double y"
+.Sh DESCRIPTION
+The
+.Fn copysign ,
+.Fn copysignf ,
+and
+.Fn copysignl
+functions return a value whose absolute value matches
+.Fa x ,
+but whose sign bit is taken from
+.Fa y .
+.Sh RETURN VALUES
+Upon successful completion,
+all three functions return a value with the magnitude of
+.Fa x
+and the sign of
+.Fa y .
+If
+.Fa x
+is
+\*(Na ,
+the functions return a
+\*(Na
+with the sign of
+.Fa y .
+.Sh SEE ALSO
+.Xr math 3 ,
+.Xr signbit 3
+.Sh STANDARDS
+The described functions conform to
+.St -isoC-99 .
+.\"
+.\" XXX: Verify this.
+.\"
+.\" The functions are also recommended by
+.\" .St -ieee754
+.\"
+.\" .Sh HISTORY
+.\"
+.\" XXX: Fill this.
+.\"
+.\" These functions first appeared in ???.
+.\"
+.Sh CAVEATS
+Note that on implementations that represent a signed zero
+but do not treat negative zero consistently in arithmetic operations,
+these functions may regard the sign of zero as positive.
diff -r eac1b9cd90ae -r 42c6a378cef3 lib/libm/man/ieee.3
--- a/lib/libm/man/ieee.3       Wed Apr 13 03:40:00 2011 +0000
+++ b/lib/libm/man/ieee.3       Wed Apr 13 04:57:10 2011 +0000
@@ -26,21 +26,16 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     from: @(#)ieee.3       6.4 (Berkeley) 5/6/91
-.\"    $NetBSD: ieee.3,v 1.23 2011/04/12 07:29:50 jruoho Exp $
+.\"    $NetBSD: ieee.3,v 1.24 2011/04/13 04:57:10 jruoho Exp $
 .\"
 .Dd April 12, 2011
 .Dt IEEE 3
 .Os
 .Sh NAME
-.Nm copysign ,
-.Nm copysignf ,
-.Nm copysignl ,
 .Nm finite ,
 .Nm finitef ,
 .Nm ilogb ,
 .Nm ilogbf ,
-.Nm remainder ,
-.Nm remainderf ,
 .Nm scalbn ,
 .Nm scalbnf
 .Nd functions for IEEE arithmetic
@@ -48,12 +43,6 @@
 .Lb libm
 .Sh SYNOPSIS
 .In math.h
-.Ft double
-.Fn copysign "double x" "double y"
-.Ft float
-.Fn copysignf "float x" "float y"
-.Ft long double
-.Fn copysignl "long double x" "long double y"
 .Ft int
 .Fn finite "double x"
 .Ft int
@@ -63,14 +52,6 @@
 .Ft int
 .Fn ilogbf "float x"
 .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"
-.Ft double
 .Fn scalbn "double x" "int n"
 .Ft float
 .Fn scalbnf "float x" "int n"
@@ -78,12 +59,6 @@
 These functions are required or recommended by
 .St -ieee754 .
 .Pp
-.Fn copysign
-returns
-.Fa x
-with its sign changed to
-.Fa y Ns 's .
-.Pp
 .Fn finite
 returns the value 1 just when
 \-\*(If \*(Lt
@@ -109,60 +84,7 @@
 .Fn ilogb 0
 returns
 .Dv INT_MIN .
-.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.
-.Pp
-.Fn remquo
-is the same as
-.Fn remainder
-but also stores 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.
 .Pp
 .Fn scalbn
 returns
diff -r eac1b9cd90ae -r 42c6a378cef3 lib/libm/man/remainder.3
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libm/man/remainder.3  Wed Apr 13 04:57:10 2011 +0000
@@ -0,0 +1,149 @@
+.\" $NetBSD: remainder.3,v 1.1 2011/04/13 04:57:10 jruoho Exp $
+.\"
+.\" Copyright (c) 2011 Jukka Ruohonen <jruohonen%iki.fi@localhost>
+.\" 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.



Home | Main Index | Thread Index | Old Index