NetBSD/lib/libc/gen/ldexp.3

92 lines
3.0 KiB
Groff
Raw Normal View History

2002-02-07 10:00:09 +03:00
.\" $NetBSD: ldexp.3,v 1.9 2002/02/07 07:00:15 ross Exp $
.\"
.\" Copyright (c) 1991, 1993
.\" The Regents of the University of California. All rights reserved.
1993-03-21 12:45:37 +03:00
.\"
.\" This code is derived from software contributed to Berkeley by
.\" the American National Standards Committee X3, on Information
.\" Processing Systems.
.\"
.\" 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.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
.\"
.\" @(#)ldexp.3 8.2 (Berkeley) 4/19/94
1993-03-21 12:45:37 +03:00
.\"
1999-08-29 22:55:29 +04:00
.Dd August 29, 1999
1993-03-21 12:45:37 +03:00
.Dt LDEXP 3
.Os
.Sh NAME
.Nm ldexp
.Nd multiply floating-point number by integral power of 2
1998-02-05 21:45:17 +03:00
.Sh LIBRARY
.Lb libc
1993-03-21 12:45:37 +03:00
.Sh SYNOPSIS
2002-02-07 10:00:09 +03:00
.Fd #include \*[Lt]math.h\*[Gt]
1993-03-21 12:45:37 +03:00
.Ft double
.Fn ldexp "double x" "int exp"
.Sh DESCRIPTION
The
.Fn ldexp
function multiplies a floating-point number by an integral
power of 2.
.Sh RETURN VALUES
The
.Fn ldexp
function returns the value of
.Fa x
times 2 raised to the power
.Fa exp .
.Pp
1999-08-29 22:52:18 +04:00
If the input
.Va x
is a NaN, infinity, or 0.0, it is returned unchanged.
.Pp
If the result would cause an overflow,
1993-03-21 12:45:37 +03:00
the global variable
.Va errno
is set to
.Er ERANGE
1999-08-29 22:55:29 +04:00
and infinity is returned, with the same sign as
1999-08-29 22:52:18 +04:00
.Fa x .
.Pp
If the result would cause underflow to 0.0,
the global variable
.Va errno
is set to
.Er ERANGE
and the value 0.0 is returned.
1993-03-21 12:45:37 +03:00
.Sh SEE ALSO
.Xr frexp 3 ,
.Xr math 3 ,
.Xr modf 3
1993-03-21 12:45:37 +03:00
.Sh STANDARDS
The
.Fn ldexp
1993-10-18 23:04:00 +03:00
function conforms to
1993-03-21 12:45:37 +03:00
.St -ansiC .