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 the logarithm functions from the perplex ...



details:   https://anonhg.NetBSD.org/src/rev/9397d4b59068
branches:  trunk
changeset: 769517:9397d4b59068
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Tue Sep 13 05:26:47 2011 +0000

description:
Split out the logarithm functions from the perplex exp(3). Also remove some
useless notes in the latter (namely, no one cares that financial calculations
were done on Hewlett-Packard HP-71B, or that there is a LN1() in Pascal).

diffstat:

 lib/libm/Makefile  |   17 +++--
 lib/libm/man/exp.3 |  135 ++----------------------------------------
 lib/libm/man/log.3 |  169 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 186 insertions(+), 135 deletions(-)

diffs (truncated from 427 to 300 lines):

diff -r 09b75a2d3074 -r 9397d4b59068 lib/libm/Makefile
--- a/lib/libm/Makefile Tue Sep 13 04:24:30 2011 +0000
+++ b/lib/libm/Makefile Tue Sep 13 05:26:47 2011 +0000
@@ -1,4 +1,4 @@
-#  $NetBSD: Makefile,v 1.118 2011/08/06 11:01:12 jruoho Exp $
+#  $NetBSD: Makefile,v 1.119 2011/09/13 05:26:47 jruoho Exp $
 #
 #  @(#)Makefile 5.1beta 93/09/24
 #
@@ -210,7 +210,7 @@
        ceil.3 copysign.3 cos.3 cosh.3 \
        erf.3 exp.3 \
        fabs.3 finite.3 fmod.3 frexp.3 hypot.3 \
-       ieee_test.3 ilogb.3 isinff.3 j0.3 ldexp.3 lgamma.3 lrint.3 \
+       ieee_test.3 ilogb.3 isinff.3 j0.3 ldexp.3 lgamma.3 log.3 lrint.3 \
        math.3 modf.3 nextafter.3 \
        remainder.3 rint.3 round.3 \
        scalbn.3 sin.3 sinh.3 sqrt.3 \
@@ -246,11 +246,14 @@
 MLINKS+=erf.3 erff.3 erf.3 erfc.3 erf.3 erfcf.3
 MLINKS+=exp.3 expf.3 exp.3 expm1.3 exp.3 expm1f.3                      \
        exp.3 exp2.3 exp.3 exp2f.3                                      \
-       exp.3 log.3 exp.3 logf.3                                        \
-       exp.3 log10.3 exp.3 log10f.3                                    \
-       exp.3 log1p.3 exp.3 log1pf.3                                    \
-       exp.3 pow.3 exp.3 powf.3                                        \
-       exp.3 log2.3 exp.3 log2f.3
+       exp.3 pow.3 exp.3 powf.3
+MLINKS+=log.3 logf.3 \
+       log.3 log10.3 \
+       log.3 log10f.3 \
+       log.3 log1p.3 \
+       log.3 log1pf.3 \
+       log.3 log2.3 \
+       log.3 log2f.3
 MLINKS+=fabs.3 fabsf.3
 MLINKS+=finite.3 finitef.3
 MLINKS+=fmod.3 fmodf.3
diff -r 09b75a2d3074 -r 9397d4b59068 lib/libm/man/exp.3
--- a/lib/libm/man/exp.3        Tue Sep 13 04:24:30 2011 +0000
+++ b/lib/libm/man/exp.3        Tue Sep 13 05:26:47 2011 +0000
@@ -27,9 +27,9 @@
 .\"
 .\"     from: @(#)exp.3        6.12 (Berkeley) 7/31/91
 .\" $FreeBSD: src/lib/msun/man/exp.3,v 1.24 2008/01/18 21:43:00 das Exp $
-.\"    $NetBSD: exp.3,v 1.26 2010/05/03 05:35:58 jruoho Exp $
+.\"    $NetBSD: exp.3,v 1.27 2011/09/13 05:26:47 jruoho Exp $
 .\"
-.Dd May 3, 2010
+.Dd September 13, 2011
 .Dt EXP 3
 .Os
 .Sh NAME
@@ -41,17 +41,9 @@
 .\" .Nm exp2l ,
 .Nm expm1 ,
 .Nm expm1f ,
-.Nm log ,
-.Nm logf ,
-.Nm log2 ,
-.Nm log2f ,
-.Nm log10 ,
-.Nm log10f ,
-.Nm log1p ,
-.Nm log1pf ,
 .Nm pow ,
 .Nm powf
-.Nd exponential, logarithm, power functions
+.Nd exponential and power functions
 .Sh LIBRARY
 .Lb libm
 .Sh SYNOPSIS
@@ -71,22 +63,6 @@
 .Ft float
 .Fn expm1f "float x"
 .Ft double
-.Fn log "double x"
-.Ft float
-.Fn logf "float x"
-.Ft double
-.Fn log2 "double x"
-.Ft float
-.Fn log2f "float x"
-.Ft double
-.Fn log10 "double x"
-.Ft float
-.Fn log10f "float x"
-.Ft double
-.Fn log1p "double x"
-.Ft float
-.Fn log1pf "float x"
-.Ft double
 .Fn pow "double x" "double y"
 .Ft float
 .Fn powf "float x" "float y"
@@ -118,31 +94,6 @@
 .Fa x .
 .Pp
 The
-.Fn log
-function computes the value of the natural logarithm of argument
-.Fa x .
-.Pp
-The
-.Fn log10
-function computes the value of the logarithm of argument
-.Fa x
-to base 10.
-.Pp
-The
-.Fn log1p
-function computes
-the value of log(1+x) accurately even for tiny argument
-.Fa x .
-.Pp
-The
-.Fn log2
-and the
-.Fn log2f
-functions compute the value of the logarithm of argument
-.Fa x
-to base 2.
-.Pp
-The
 .Fn pow
 and
 .Fn powf
@@ -180,41 +131,15 @@
 and on the
 .Tn VAX
 generate a reserved operand fault.
-On a
-.Tn VAX ,
-.Va errno
-is set to
-.Er EDOM
-and the reserved operand is returned
-by log unless
-.Fa x
-\*[Gt] 0, by
-.Fn log1p
-unless
-.Fa x
-\*[Gt] \-1.
 .Sh ERRORS
 The values of
 .Fn exp x ,
 .Fn expm1 x ,
+and
 .Fn exp2 x ,
-.Fn log x ,
-and
-.Fn log1p x ,
 are exact provided that they are representable.
 Otherwise the error in these functions is generally below one
 .Em ulp .
-The values of
-.Fn log10 x
-are within about 2
-.Em ulps ;
-an
-.Em ulp
-is one
-.Em Unit
-in the
-.Em Last
-.Em Place .
 The error in
 .Fn pow x y
 is below about 2
@@ -248,36 +173,6 @@
 .Tn IEEE
 754.
 .Sh NOTES
-The functions 
-.Fn exp x\ \-\ 1
-and
-.Fn log 1\ \+\ x
-are called
-.Fn expm1 x
-and 
-.Fn logp1 x
-in
-.Tn BASIC
-on the Hewlett\-Packard
-.Tn HP Ns \-71B
-and
-.Tn APPLE
-Macintosh,
-.Tn EXP1
-and
-.Tn LN1
-in Pascal,
-.Fn exp1 x
-and
-.Fn log1 x
-in C
-on
-.Tn APPLE
-Macintoshes, where they have been provided to make
-sure financial calculations of ((1+x)**n\-1)/x, namely
-expm1(n*log1p(x))/x, will be accurate when x is tiny.
-They also provide accurate inverse hyperbolic functions.
-.Pp
 The function
 .Fn pow x 0
 returns x**0 = 1 for all x including x = 0,
@@ -340,9 +235,7 @@
 .Xr math 3
 .Sh STANDARDS
 The
-.Fn exp ,
-.Fn log ,
-.Fn log10
+.Fn exp
 and
 .Fn pow
 functions conform to
@@ -353,33 +246,19 @@
 .Fn expf ,
 .Fn expm1 ,
 .Fn expm1f ,
-.Fn log1p ,
-.Fn log1pf ,
-.Fn log2 ,
-.Fn log2f ,
-.Fn log10f ,
-.Fn logf ,
 and
 .Fn powf
 functions conform to
 .St -isoC-99 .
 .Sh HISTORY
 A
-.Fn exp ,
-.Fn log
+.Fn exp
 and
 .Fn pow
 functions
 appeared in
 .At v6 .
-A
-.Fn log10
-function
-appeared in
-.At v7 .
 The
-.Fn log1p
-and
 .Fn expm1
-functions appeared in
+function appeared in
 .Bx 4.3 .
diff -r 09b75a2d3074 -r 9397d4b59068 lib/libm/man/log.3
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libm/man/log.3        Tue Sep 13 05:26:47 2011 +0000
@@ -0,0 +1,169 @@
+.\" $NetBSD: log.3,v 1.1 2011/09/13 05:26:47 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 September 13, 2011
+.Dt SCALBN 3
+.Os
+.Sh NAME
+.Nm log ,
+.Nm logf ,
+.Nm log10 ,
+.Nm log10f ,
+.Nm log1p ,
+.Nm log1pf
+.Nm log2 ,
+.Nm log2f ,
+.Nd logarithm functions
+.Sh LIBRARY
+.Lb libm
+.Sh SYNOPSIS



Home | Main Index | Thread Index | Old Index