xref: /netbsd-src/lib/libm/man/ldexp.3 (revision 71f379ad51f72c27767914fabec980e2408fdefa)
1*71f379adSnros.\"	$NetBSD: ldexp.3,v 1.5 2016/03/17 18:29:59 nros Exp $
251086becSdrochner.\"
351086becSdrochner.\" Copyright (c) 1991, 1993
451086becSdrochner.\"	The Regents of the University of California.  All rights reserved.
551086becSdrochner.\"
651086becSdrochner.\" This code is derived from software contributed to Berkeley by
751086becSdrochner.\" the American National Standards Committee X3, on Information
851086becSdrochner.\" Processing Systems.
951086becSdrochner.\"
1051086becSdrochner.\" Redistribution and use in source and binary forms, with or without
1151086becSdrochner.\" modification, are permitted provided that the following conditions
1251086becSdrochner.\" are met:
1351086becSdrochner.\" 1. Redistributions of source code must retain the above copyright
1451086becSdrochner.\"    notice, this list of conditions and the following disclaimer.
1551086becSdrochner.\" 2. Redistributions in binary form must reproduce the above copyright
1651086becSdrochner.\"    notice, this list of conditions and the following disclaimer in the
1751086becSdrochner.\"    documentation and/or other materials provided with the distribution.
1851086becSdrochner.\" 3. Neither the name of the University nor the names of its contributors
1951086becSdrochner.\"    may be used to endorse or promote products derived from this software
2051086becSdrochner.\"    without specific prior written permission.
2151086becSdrochner.\"
2251086becSdrochner.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2351086becSdrochner.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2451086becSdrochner.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2551086becSdrochner.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2651086becSdrochner.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2751086becSdrochner.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2851086becSdrochner.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2951086becSdrochner.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3051086becSdrochner.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3151086becSdrochner.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3251086becSdrochner.\" SUCH DAMAGE.
3351086becSdrochner.\"
3451086becSdrochner.\"     @(#)ldexp.3	8.2 (Berkeley) 4/19/94
3551086becSdrochner.\"
36*71f379adSnros.Dd March 17, 2016
3751086becSdrochner.Dt LDEXP 3
3851086becSdrochner.Os
3951086becSdrochner.Sh NAME
40bc80f14dSjruoho.Nm ldexp ,
41*71f379adSnros.Nm ldexpf ,
42*71f379adSnros.Nm ldexpl
4351086becSdrochner.Nd multiply floating-point number by integral power of 2
4451086becSdrochner.Sh LIBRARY
4551086becSdrochner.Lb libm
4651086becSdrochner.Sh SYNOPSIS
4751086becSdrochner.In math.h
4851086becSdrochner.Ft double
4951086becSdrochner.Fn ldexp "double x" "int exp"
5051086becSdrochner.Ft float
5151086becSdrochner.Fn ldexpf "float x" "int exp"
52*71f379adSnros.Ft long double
53*71f379adSnros.Fn ldexpl "long double x" "int exp"
5451086becSdrochner.Sh DESCRIPTION
5551086becSdrochnerThe
5651086becSdrochner.Fn ldexp
57bc80f14dSjruohofamily of functions compute
58bc80f14dSjruoho.Bd -ragged -offset indent
59bc80f14dSjruoho.Va x
60bc80f14dSjruoho*
61bc80f14dSjruoho2^\fIexp\fR
62bc80f14dSjruoho.Ed
63bc80f14dSjruoho.Pp
64bc80f14dSjruohofor a real floating-point number
65bc80f14dSjruoho.Fa x .
6651086becSdrochner.Sh RETURN VALUES
67bc80f14dSjruohoThe functions return the value of
6851086becSdrochner.Fa x
6951086becSdrochnertimes 2 raised to the power
7051086becSdrochner.Fa exp .
71bc80f14dSjruohoOtherwise the following may occur:
72bc80f14dSjruoho.Bl -enum -offset indent
73bc80f14dSjruoho.It
74bc80f14dSjruohoIf
75bc80f14dSjruoho.Fa x
76bc80f14dSjruohois \*(Na, a \*(Na is returned.
77bc80f14dSjruoho.It
78bc80f14dSjruohoIf
79bc80f14dSjruoho.Fa exp
80bc80f14dSjruohois zero or
81bc80f14dSjruoho.Fa x
8243675611Swizis either \*(Pm 0 or \*(Pm\[if],
83bc80f14dSjruoho.Fa x
84bc80f14dSjruohois returned.
85bc80f14dSjruoho.It
86bc80f14dSjruohoIf the call would cause an overflow, a range error occurs and either
87bc80f14dSjruoho.Dv \*(Pm\*HHUGE_VAL ,
88bc80f14dSjruoho.Dv  \*(Pm\*HHUGE_VALF ,
89bc80f14dSjruohoor
90bc80f14dSjruoho.Dv  \*(Pm\*HHUGE_VALL
91bc80f14dSjruohois returned, depending on the sign of
92bc80f14dSjruoho.Fa x
93bc80f14dSjruohoand the type of the return value.
94bc80f14dSjruoho.It
95bc80f14dSjruohoIf an underflow would be caused by the correct value,
96bc80f14dSjruohoand the value is not representable, either 0.0 or
97bc80f14dSjruohoan implementation-defined value is returned.
98bc80f14dSjruoho.El
9951086becSdrochner.Sh SEE ALSO
10051086becSdrochner.Xr frexp 3 ,
10151086becSdrochner.Xr math 3 ,
10251086becSdrochner.Xr modf 3
10351086becSdrochner.Sh STANDARDS
104bc80f14dSjruohoThe described functions conform to
105bc80f14dSjruoho.St -isoC-99 .
106