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 ilogb(3) family out of ieee(3) and pr...
details: https://anonhg.NetBSD.org/src/rev/4cecd5727ac8
branches: trunk
changeset: 764870:4cecd5727ac8
user: jruoho <jruoho%NetBSD.org@localhost>
date: Tue May 10 06:38:33 2011 +0000
description:
Split out the ilogb(3) family out of ieee(3) and properly document it.
diffstat:
lib/libm/Makefile | 6 +-
lib/libm/man/ieee.3 | 22 +---------
lib/libm/man/ilogb.3 | 110 +++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 114 insertions(+), 24 deletions(-)
diffs (198 lines):
diff -r b8993bf1e198 -r 4cecd5727ac8 lib/libm/Makefile
--- a/lib/libm/Makefile Tue May 10 05:08:51 2011 +0000
+++ b/lib/libm/Makefile Tue May 10 06:38:33 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.107 2011/04/16 05:48:50 jruoho Exp $
+# $NetBSD: Makefile,v 1.108 2011/05/10 06:38:33 jruoho Exp $
#
# @(#)Makefile 5.1beta 93/09/24
#
@@ -204,7 +204,7 @@
ceil.3 copysign.3 cos.3 cosh.3 \
erf.3 exp.3 \
fabs.3 fmod.3 frexp.3 hypot.3 ieee.3 \
- ieee_test.3 isinff.3 j0.3 ldexp.3 lgamma.3 lrint.3 \
+ 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 \
@@ -249,11 +249,11 @@
MLINKS+=fmod.3 fmodf.3
MLINKS+=hypot.3 hypotf.3
MLINKS+=ieee.3 finite.3 ieee.3 finitef.3 \
- ieee.3 ilogb.3 ieee.3 ilogbf.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
MLINKS+=ieee_test.3 significand.3 ieee_test.3 significandf.3
+MLINKS+=ilogb.3 ilogbf.3 \
MLINKS+=isinff.3 isnanf.3
MLINKS+=j0.3 j0f.3 j0.3 j1.3 j0.3 j1f.3 j0.3 jn.3 j0.3 jnf.3 \
j0.3 y0.3 j0.3 y0f.3 j0.3 y1.3 j0.3 y1f.3 j0.3 yn.3 j0.3 ynf.3
diff -r b8993bf1e198 -r 4cecd5727ac8 lib/libm/man/ieee.3
--- a/lib/libm/man/ieee.3 Tue May 10 05:08:51 2011 +0000
+++ b/lib/libm/man/ieee.3 Tue May 10 06:38:33 2011 +0000
@@ -26,7 +26,7 @@
.\" SUCH DAMAGE.
.\"
.\" from: @(#)ieee.3 6.4 (Berkeley) 5/6/91
-.\" $NetBSD: ieee.3,v 1.24 2011/04/13 04:57:10 jruoho Exp $
+.\" $NetBSD: ieee.3,v 1.25 2011/05/10 06:38:33 jruoho Exp $
.\"
.Dd April 12, 2011
.Dt IEEE 3
@@ -34,8 +34,6 @@
.Sh NAME
.Nm finite ,
.Nm finitef ,
-.Nm ilogb ,
-.Nm ilogbf ,
.Nm scalbn ,
.Nm scalbnf
.Nd functions for IEEE arithmetic
@@ -47,10 +45,6 @@
.Fn finite "double x"
.Ft int
.Fn finitef "float x"
-.Ft int
-.Fn ilogb "double x"
-.Ft int
-.Fn ilogbf "float x"
.Ft double
.Fn scalbn "double x" "int n"
.Ft float
@@ -72,20 +66,6 @@
.Fa x
is \*(Na).
.Pp
-.Fn ilogb
-returns
-.Fa x Ns 's exponent
-.Fa n ,
-in integer format.
-.Fn ilogb \*(Pm\*(If
-returns
-.Dv INT_MAX
-and
-.Fn ilogb 0
-returns
-.Dv INT_MIN .
-is even.
-.Pp
.Fn scalbn
returns
.Fa x Ns \(**(2** Ns Fa n )
diff -r b8993bf1e198 -r 4cecd5727ac8 lib/libm/man/ilogb.3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libm/man/ilogb.3 Tue May 10 06:38:33 2011 +0000
@@ -0,0 +1,110 @@
+.\" $NetBSD: ilogb.3,v 1.1 2011/05/10 06:38:33 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 10, 2011
+.Dt ILOGB 3
+.Os
+.Sh NAME
+.Nm ilogb ,
+.Nm ilogbf
+.Nd an unbiased exponent
+.Sh LIBRARY
+.Lb libm
+.Sh SYNOPSIS
+.In math.h
+.Ft int
+.Fn ilogb "double x"
+.Ft int
+.Fn ilogbf "float x"
+.Sh DESCRIPTION
+The
+.Fn ilogb
+and
+.Fn ilogbf
+functions return the exponent of the non-zero real floating-point number
+.Fa x
+as a signed integer value.
+Formally the return value is the integral part of
+.Bd -ragged -offset indent
+log_r |
+.Va x | ,
+.Ed
+.Pp
+where
+.Fa r
+is the radix of the machine's floating-point arithmetic defined by the
+.Dv FLT_RADIX
+constant in
+.In float.h .
+.Sh RETURN VALUES
+As described above, upon successful completion,
+the functions return the exponent.
+Functionally this is the same as calling the corresponding
+.Xr logb 3
+function and casting the return value to
+.Vt int .
+.Pp
+The following special cases may occur:
+.Bl -enum -offset indent
+.It
+If
+.Fa x
+is zero, the value of
+.Dv FP_ILOGB0
+is returned and a domain error occurs.
+.It
+If
+.Fa x
+is infinite, a domain error occurs and the value of
+.Dv INT_MAX
+is returned.
+.It
+If
+.Fa x
+is \*(Na, a domain error is raised and the value of
+.Dv FP_ILOGBNAN
+is returned.
+.It
+If the correct value is outside the range of the return type,
+a domain error occurs but an unspecified value is returned.
+.El
+.Sh SEE ALSO
+.Xr ilog2 3 ,
+.Xr logb 3 ,
+.Xr math 3
+.Sh STANDARDS
+The described functions conform to
+.St -isoC-99 .
+.Sh BUGS
+Neither
+.Dv FP_ILOGB0
+nor
+.Dv FP_ILOGBNAN
+is defined currently in
+.Nx .
+Furthermore, the
+.Vt long double
+variant of the functions is not yet supported.
Home |
Main Index |
Thread Index |
Old Index