OSDN Git Service

c1767f3f4fd71b0447a69fe1340e0c3aa8696cf2
[linuxjm/LDP_man-pages.git] / original / man3 / ldexp.3
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
3 .\"     <mtk.manpages@gmail.com>
4 .\"
5 .\" %%%LICENSE_START(VERBATIM)
6 .\" Permission is granted to make and distribute verbatim copies of this
7 .\" manual provided the copyright notice and this permission notice are
8 .\" preserved on all copies.
9 .\"
10 .\" Permission is granted to copy and distribute modified versions of this
11 .\" manual under the conditions for verbatim copying, provided that the
12 .\" entire resulting derived work is distributed under the terms of a
13 .\" permission notice identical to this one.
14 .\"
15 .\" Since the Linux kernel and libraries are constantly changing, this
16 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
17 .\" responsibility for errors or omissions, or for damages resulting from
18 .\" the use of the information contained herein.  The author(s) may not
19 .\" have taken the same level of care in the production of this manual,
20 .\" which is licensed free of charge, as they might when working
21 .\" professionally.
22 .\"
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" %%%LICENSE_END
26 .\"
27 .\" References consulted:
28 .\"     Linux libc source code
29 .\"     Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
30 .\"     386BSD man pages
31 .\" Modified 1993-07-24 by Rik Faith (faith@cs.unc.edu)
32 .\" Modified 2004-10-31 by aeb
33 .\"
34 .TH LDEXP 3 2013-08-19 "" "Linux Programmer's Manual"
35 .SH NAME
36 ldexp, ldexpf, ldexpl \- multiply floating-point number by integral power of 2
37 .SH SYNOPSIS
38 .nf
39 .B #include <math.h>
40 .sp
41 .BI "double ldexp(double " x ", int " exp );
42 .br
43 .BI "float ldexpf(float " x ", int " exp );
44 .br
45 .BI "long double ldexpl(long double " x ", int " exp );
46 .fi
47 .sp
48 Link with \fI\-lm\fP.
49 .sp
50 .in -4n
51 Feature Test Macro Requirements for glibc (see
52 .BR feature_test_macros (7)):
53 .in
54 .sp
55 .ad l
56 .BR ldexpf (),
57 .BR ldexpl ():
58 .RS 4
59 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE ||
60 _POSIX_C_SOURCE\ >=\ 200112L;
61 .br
62 or
63 .I cc\ -std=c99
64 .RE
65 .ad
66 .SH DESCRIPTION
67 The
68 .BR ldexp ()
69 function returns the result of multiplying the floating-point number
70 .I x
71 by 2 raised to the power
72 .IR exp .
73 .SH RETURN VALUE
74 On success, these functions return
75 .IR "x * (2^exp)" .
76
77 If
78 .I exp
79 is zero, then
80 .I x
81 is returned.
82
83 If
84 .I x
85 is a NaN,
86 a NaN is returned.
87
88 If
89 .I x
90 is positive infinity (negative infinity),
91 positive infinity (negative infinity) is returned.
92
93 If the result underflows,
94 a range error occurs,
95 and zero is returned.
96
97 If the result overflows,
98 a range error occurs,
99 and the functions return
100 .BR HUGE_VAL ,
101 .BR HUGE_VALF ,
102 or
103 .BR HUGE_VALL ,
104 respectively, with a sign the same as
105 .IR x .
106 .SH ERRORS
107 See
108 .BR math_error (7)
109 for information on how to determine whether an error has occurred
110 when calling these functions.
111 .PP
112 The following errors can occur:
113 .TP
114 Range error, overflow
115 .I errno
116 is set to
117 .BR ERANGE .
118 An overflow floating-point exception
119 .RB ( FE_OVERFLOW )
120 is raised.
121 .TP
122 Range error, underflow
123 .I errno
124 is set to
125 .BR ERANGE .
126 An underflow floating-point exception
127 .RB ( FE_UNDERFLOW )
128 is raised.
129 .SH ATTRIBUTES
130 .SS Multithreading (see pthreads(7))
131 The
132 .BR ldexp (),
133 .BR ldexpf (),
134 and
135 .BR ldexpl ()
136 functions are thread-safe.
137 .SH CONFORMING TO
138 C99, POSIX.1-2001.
139 The variant returning
140 .I double
141 also conforms to
142 SVr4, 4.3BSD, C89.
143 .SH SEE ALSO
144 .BR frexp (3),
145 .BR modf (3),
146 .BR scalbln (3)
147 .SH COLOPHON
148 This page is part of release 3.67 of the Linux
149 .I man-pages
150 project.
151 A description of the project,
152 information about reporting bugs,
153 and the latest version of this page,
154 can be found at
155 \%http://www.kernel.org/doc/man\-pages/.