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 scalbn(3) family out from ieee(3) and...



details:   https://anonhg.NetBSD.org/src/rev/f8c1241a798c
branches:  trunk
changeset: 767997:f8c1241a798c
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Sat Aug 06 10:51:26 2011 +0000

description:
Split out the scalbn(3) family out from ieee(3) and properly document it.

diffstat:

 lib/libm/Makefile     |    9 ++-
 lib/libm/man/ieee.3   |   16 +------
 lib/libm/man/scalbn.3 |  114 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 120 insertions(+), 19 deletions(-)

diffs (202 lines):

diff -r 07885d70e6c0 -r f8c1241a798c lib/libm/Makefile
--- a/lib/libm/Makefile Sat Aug 06 08:49:04 2011 +0000
+++ b/lib/libm/Makefile Sat Aug 06 10:51:26 2011 +0000
@@ -1,4 +1,4 @@
-#  $NetBSD: Makefile,v 1.116 2011/08/03 14:13:07 joerg Exp $
+#  $NetBSD: Makefile,v 1.117 2011/08/06 10:51:26 jruoho Exp $
 #
 #  @(#)Makefile 5.1beta 93/09/24
 #
@@ -213,7 +213,7 @@
        ieee_test.3 ilogb.3 isinff.3 j0.3 ldexp.3 lgamma.3 lrint.3 \
        math.3 modf.3 nextafter.3 \
        remainder.3 rint.3 round.3 \
-       sin.3 sinh.3 sqrt.3 \
+       scalbn.3 sin.3 sinh.3 sqrt.3 \
        tan.3 tanh.3 trunc.3 fmax.3 fdim.3
 
 # fenv.h interface
@@ -254,8 +254,7 @@
 MLINKS+=fabs.3 fabsf.3
 MLINKS+=fmod.3 fmodf.3
 MLINKS+=hypot.3 hypotf.3
-MLINKS+=ieee.3 finite.3 ieee.3 finitef.3                               \
-       ieee.3 scalbn.3 ieee.3 scalbnf.3 ieee.3 scalbnl.3
+MLINKS+=ieee.3 finite.3 ieee.3 finitef.3
 MLINKS+=ieee_test.3 logb.3 ieee_test.3 logbf.3 ieee_test.3 logbl.3
 MLINKS+=ieee_test.3 scalb.3 ieee_test.3 scalbf.3
 MLINKS+=ieee_test.3 significand.3 ieee_test.3 significandf.3
@@ -274,6 +273,8 @@
        remainder.3 remquo.3 \
        remainder.3 remquof.3
 MLINKS+=rint.3 rintf.3
+MLINKS+=scalbn.3 scalbnf.3 \
+       scalbn.3 scalbnl.3
 MLINKS+=sin.3 sinf.3
 MLINKS+=sinf.3 sinhf.3
 MLINKS+=sqrt.3 sqrtf.3 sqrt.3 cbrt.3 sqrt.3 cbrtf.3
diff -r 07885d70e6c0 -r f8c1241a798c lib/libm/man/ieee.3
--- a/lib/libm/man/ieee.3       Sat Aug 06 08:49:04 2011 +0000
+++ b/lib/libm/man/ieee.3       Sat Aug 06 10:51:26 2011 +0000
@@ -26,7 +26,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     from: @(#)ieee.3       6.4 (Berkeley) 5/6/91
-.\"    $NetBSD: ieee.3,v 1.27 2011/08/02 10:08:24 wiz Exp $
+.\"    $NetBSD: ieee.3,v 1.28 2011/08/06 10:51:26 jruoho Exp $
 .\"
 .Dd July 28, 2011
 .Dt IEEE 3
@@ -34,9 +34,6 @@
 .Sh NAME
 .Nm finite ,
 .Nm finitef ,
-.Nm scalbn ,
-.Nm scalbnf ,
-.Nm scalbnl
 .Nd functions for IEEE arithmetic
 .Sh LIBRARY
 .Lb libm
@@ -46,12 +43,6 @@
 .Fn finite "double x"
 .Ft int
 .Fn finitef "float x"
-.Ft double
-.Fn scalbn "double x" "int n"
-.Ft float
-.Fn scalbnf "float x" "int n"
-.Ft long double
-.Fn scalbnl "long double x" "int n"
 .Sh DESCRIPTION
 These functions are required or recommended by
 .St -ieee754 .
@@ -68,11 +59,6 @@
 = \*(If or
 .Fa x
 is \*(Na).
-.Pp
-.Fn scalbn
-returns
-.Fa x Ns \(**(2** Ns Fa n )
-computed by exponent manipulation.
 .Sh SEE ALSO
 .Xr math 3 ,
 .Xr nextafter 3
diff -r 07885d70e6c0 -r f8c1241a798c lib/libm/man/scalbn.3
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libm/man/scalbn.3     Sat Aug 06 10:51:26 2011 +0000
@@ -0,0 +1,114 @@
+.\" $NetBSD: scalbn.3,v 1.1 2011/08/06 10:51:26 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 May 31, 2011
+.Dt SCALBN 3
+.Os
+.Sh NAME
+.Nm scalbn ,
+.Nm scalbnf ,
+.Nm scalbnl
+.Nd exponent using FLT_RADIX
+.Sh LIBRARY
+.Lb libm
+.Sh SYNOPSIS
+.In math.h
+.Ft double
+.Fn scalbn "double x" "int n"
+.Ft float
+.Fn scalbnf "float x" "int n"
+.Ft long double
+.Fn scalbnl "long double x" "int n"
+.Sh DESCRIPTION
+The
+.Fn scalbn ,
+.Fn scalbnf ,
+and
+.Fn scalbnl
+functions compute
+.Fa x
+*
+.Fa r^n ,
+where
+.Fa r
+is the radix of the machine's floating point arithmetic, defined by the
+.Dv FLT_RADIX
+constant in
+.In float.h .
+The rationale is efficiency;
+.Fa r^n
+is not computed explicitly.
+.Sh RETURN VALUES
+As described above, upon successful completion, the described functions return
+the exponent computed using
+.Dv FLT_RADIX .
+Otherwise the following may occur:
+.Pp
+.Bl -enum -offset indent
+.It
+When the result would cause an overflow, a range error occurs and
+.Dv \*(Pm\*HHUGE_VAL ,
+.Dv \*(Pm\*HHUGE_VALF ,
+or
+.Dv \*(Pm\*HHUGE_VALL
+is returned according to the sign of
+.Fa x
+and the return type of the corresponding function.
+.It
+When the correct value would cause an underflow
+and it is not representable, a range error occurs and
+either 0.0 or an implementation-defined value is returned.
+When an underflow occurs but the correct value is representable,
+a range error occurs but the correct value is returned.
+.It
+If
+.Fa x
+is \*(Pm0 or \*(Pm\Inf,
+.Fa x
+is returned.
+Likewise, if
+.Fa n
+is zero,
+.Fa x
+is returned.
+If
+.Fa x
+is \*(Na, \*(Na is returned.
+.El
+.Sh SEE ALSO
+.Xr exp 3 ,
+.Xr frexp 3 ,
+.Xr ldexp 3 ,
+.Xr math 3
+.Sh STANDARDS
+The described functions conform to
+.St -isoC-99 .
+.Sh BUGS
+.Nx
+does not support the variants where the type of
+.Fa n
+is
+.Ft long int .



Home | Main Index | Thread Index | Old Index