]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/ldexp.3
Many pages: Use correct letter case in page titles (TH)
[thirdparty/man-pages.git] / man3 / ldexp.3
CommitLineData
fea681da 1.\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
a57ce78d
MK
2.\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
3.\" <mtk.manpages@gmail.com>
fea681da 4.\"
5fbde956 5.\" SPDX-License-Identifier: Linux-man-pages-copyleft
fea681da
MK
6.\"
7.\" References consulted:
8.\" Linux libc source code
9.\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
10.\" 386BSD man pages
11.\" Modified 1993-07-24 by Rik Faith (faith@cs.unc.edu)
12.\" Modified 2004-10-31 by aeb
13.\"
4c1c5274 14.TH ldexp 3 (date) "Linux man-pages (unreleased)"
fea681da
MK
15.SH NAME
16ldexp, ldexpf, ldexpl \- multiply floating-point number by integral power of 2
6014769d
AC
17.SH LIBRARY
18Math library
8fc3b2cf 19.RI ( libm ", " \-lm )
fea681da
MK
20.SH SYNOPSIS
21.nf
22.B #include <math.h>
68e4db0a 23.PP
fea681da 24.BI "double ldexp(double " x ", int " exp );
fea681da 25.BI "float ldexpf(float " x ", int " exp );
fea681da
MK
26.BI "long double ldexpl(long double " x ", int " exp );
27.fi
68e4db0a 28.PP
d39ad78f 29.RS -4
a57ce78d
MK
30Feature Test Macro Requirements for glibc (see
31.BR feature_test_macros (7)):
d39ad78f 32.RE
68e4db0a 33.PP
a57ce78d
MK
34.BR ldexpf (),
35.BR ldexpl ():
9d2adbae 36.nf
5c10d2c5 37 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
9d2adbae
MK
38 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
39 || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
40.fi
fea681da 41.SH DESCRIPTION
5600f73a 42These functions return the result of multiplying the floating-point number
fea681da
MK
43.I x
44by 2 raised to the power
45.IR exp .
a57ce78d
MK
46.SH RETURN VALUE
47On success, these functions return
48.IR "x * (2^exp)" .
847e0d88 49.PP
a57ce78d
MK
50If
51.I exp
52is zero, then
53.I x
54is returned.
847e0d88 55.PP
a57ce78d
MK
56If
57.I x
58is a NaN,
59a NaN is returned.
847e0d88 60.PP
a57ce78d
MK
61If
62.I x
63is positive infinity (negative infinity),
64positive infinity (negative infinity) is returned.
847e0d88 65.PP
a57ce78d 66If the result underflows,
371b557b 67a range error occurs,
a57ce78d 68and zero is returned.
847e0d88 69.PP
a57ce78d 70If the result overflows,
efe294cb 71a range error occurs,
a57ce78d
MK
72and the functions return
73.BR HUGE_VAL ,
74.BR HUGE_VALF ,
75or
76.BR HUGE_VALL ,
77respectively, with a sign the same as
78.IR x .
79.SH ERRORS
80See
81.BR math_error (7)
82for information on how to determine whether an error has occurred
83when calling these functions.
84.PP
85The following errors can occur:
86.TP
87Range error, overflow
88.I errno
89is set to
90.BR ERANGE .
91An overflow floating-point exception
92.RB ( FE_OVERFLOW )
93is raised.
94.TP
95Range error, underflow
96.I errno
97is set to
98.BR ERANGE .
99An underflow floating-point exception
100.RB ( FE_UNDERFLOW )
101is raised.
742e3682 102.SH ATTRIBUTES
23514ee4
MK
103For an explanation of the terms used in this section, see
104.BR attributes (7).
c466875e
MK
105.ad l
106.nh
23514ee4
MK
107.TS
108allbox;
c466875e 109lbx lb lb
23514ee4
MK
110l l l.
111Interface Attribute Value
112T{
742e3682
PH
113.BR ldexp (),
114.BR ldexpf (),
742e3682 115.BR ldexpl ()
23514ee4
MK
116T} Thread safety MT-Safe
117.TE
c466875e
MK
118.hy
119.ad
120.sp 1
3113c7f3 121.SH STANDARDS
9a74e018 122C99, POSIX.1-2001, POSIX.1-2008.
847e0d88 123.PP
a57ce78d
MK
124The variant returning
125.I double
126also conforms to
68e1685c 127SVr4, 4.3BSD, C89.
47297adb 128.SH SEE ALSO
fea681da
MK
129.BR frexp (3),
130.BR modf (3),
a57ce78d 131.BR scalbln (3)