Module Name: src
Committed By: jruoho
Date: Sat Aug 6 10:51:26 UTC 2011
Modified Files:
src/lib/libm: Makefile
src/lib/libm/man: ieee.3
Added Files:
src/lib/libm/man: scalbn.3
Log Message:
Split out the scalbn(3) family out from ieee(3) and properly document it.
To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/lib/libm/Makefile
cvs rdiff -u -r1.27 -r1.28 src/lib/libm/man/ieee.3
cvs rdiff -u -r0 -r1.1 src/lib/libm/man/scalbn.3
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libm/Makefile
diff -u src/lib/libm/Makefile:1.116 src/lib/libm/Makefile:1.117
--- src/lib/libm/Makefile:1.116 Wed Aug 3 14:13:07 2011
+++ src/lib/libm/Makefile Sat Aug 6 10:51:26 2011
@@ -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
Index: src/lib/libm/man/ieee.3
diff -u src/lib/libm/man/ieee.3:1.27 src/lib/libm/man/ieee.3:1.28
--- src/lib/libm/man/ieee.3:1.27 Tue Aug 2 10:08:24 2011
+++ src/lib/libm/man/ieee.3 Sat Aug 6 10:51:26 2011
@@ -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
Added files:
Index: src/lib/libm/man/scalbn.3
diff -u /dev/null src/lib/libm/man/scalbn.3:1.1
--- /dev/null Sat Aug 6 10:51:26 2011
+++ src/lib/libm/man/scalbn.3 Sat Aug 6 10:51:26 2011
@@ -0,0 +1,114 @@
+.\" $NetBSD: scalbn.3,v 1.1 2011/08/06 10:51:26 jruoho Exp $
+.\"
+.\" Copyright (c) 2011 Jukka Ruohonen <[email protected]>
+.\" 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 .