]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/scalbln.3
98fec74da10fbf8b4f0781f98c08cd31154e6098
[thirdparty/man-pages.git] / man3 / scalbln.3
1 '\" t
2 .\" Copyright 2004 Andries Brouwer <aeb@cwi.nl>.
3 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
4 .\" <mtk.manpages@gmail.com>
5 .\"
6 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
7 .\"
8 .TH scalbln 3 (date) "Linux man-pages (unreleased)"
9 .SH NAME
10 scalbn, scalbnf, scalbnl, scalbln, scalblnf, scalblnl \-
11 multiply floating-point number by integral power of radix
12 .SH LIBRARY
13 Math library
14 .RI ( libm ", " \-lm )
15 .SH SYNOPSIS
16 .nf
17 .B #include <math.h>
18 .PP
19 .BI "double scalbln(double " x ", long " exp );
20 .BI "float scalblnf(float " x ", long " exp );
21 .BI "long double scalblnl(long double " x ", long " exp );
22 .PP
23 .BI "double scalbn(double " x ", int " exp );
24 .BI "float scalbnf(float " x ", int " exp );
25 .BI "long double scalbnl(long double " x ", int " exp );
26 .fi
27 .PP
28 .RS -4
29 Feature Test Macro Requirements for glibc (see
30 .BR feature_test_macros (7)):
31 .RE
32 .PP
33 .BR scalbln (),
34 .BR scalblnf (),
35 .BR scalblnl ():
36 .nf
37 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
38 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
39 .fi
40 .PP
41 .BR scalbn (),
42 .BR scalbnf (),
43 .BR scalbnl ():
44 .nf
45 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
46 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
47 || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
48 .fi
49 .SH DESCRIPTION
50 These functions multiply their first argument
51 .I x
52 by
53 .B FLT_RADIX
54 (probably 2)
55 to the power of
56 .IR exp ,
57 that is:
58 .PP
59 .nf
60 x * FLT_RADIX ** exp
61 .fi
62 .PP
63 The definition of
64 .B FLT_RADIX
65 can be obtained by including
66 .IR <float.h> .
67 .\" not in /usr/include but in a gcc lib
68 .SH RETURN VALUE
69 On success, these functions return
70 .I x
71 *
72 .B FLT_RADIX
73 **
74 .IR exp .
75 .PP
76 If
77 .I x
78 is a NaN, a NaN is returned.
79 .PP
80 If
81 .I x
82 is positive infinity (negative infinity),
83 positive infinity (negative infinity) is returned.
84 .PP
85 If
86 .I x
87 is +0 (\-0), +0 (\-0) is returned.
88 .PP
89 If the result overflows,
90 a range error occurs,
91 and the functions return
92 .BR HUGE_VAL ,
93 .BR HUGE_VALF ,
94 or
95 .BR HUGE_VALL ,
96 respectively, with a sign the same as
97 .IR x .
98 .PP
99 If the result underflows,
100 a range error occurs,
101 and the functions return zero, with a sign the same as
102 .IR x .
103 .SH ERRORS
104 See
105 .BR math_error (7)
106 for information on how to determine whether an error has occurred
107 when calling these functions.
108 .PP
109 The following errors can occur:
110 .TP
111 Range error, overflow
112 .\" .I errno
113 .\" is set to
114 .\" .BR ERANGE .
115 An overflow floating-point exception
116 .RB ( FE_OVERFLOW )
117 is raised.
118 .TP
119 Range error, underflow
120 .I errno
121 is set to
122 .BR ERANGE .
123 An underflow floating-point exception
124 .RB ( FE_UNDERFLOW )
125 is raised.
126 .SH ATTRIBUTES
127 For an explanation of the terms used in this section, see
128 .BR attributes (7).
129 .ad l
130 .nh
131 .TS
132 allbox;
133 lbx lb lb
134 l l l.
135 Interface Attribute Value
136 T{
137 .BR scalbn (),
138 .BR scalbnf (),
139 .BR scalbnl (),
140 .BR scalbln (),
141 .BR scalblnf (),
142 .BR scalblnl ()
143 T} Thread safety MT-Safe
144 .TE
145 .hy
146 .ad
147 .sp 1
148 .SH STANDARDS
149 C11, POSIX.1-2008.
150 .SH HISTORY
151 glibc 2.1.
152 C99, POSIX.1-2001.
153 .SH HISTORY
154 These functions differ from the obsolete functions described in
155 .BR scalb (3)
156 in the type of their second argument.
157 The functions described on this page have a second argument
158 of an integral type, while those in
159 .BR scalb (3)
160 have a second argument of type
161 .IR double .
162 .SH NOTES
163 If
164 .B FLT_RADIX
165 equals 2 (which is usual), then
166 .BR scalbn ()
167 is equivalent to
168 .BR ldexp (3).
169 .SH BUGS
170 Before glibc 2.20,
171 .\" https://www.sourceware.org/bugzilla/show_bug.cgi?id=6803
172 these functions did not set
173 .I errno
174 for range errors.
175 .SH SEE ALSO
176 .BR ldexp (3),
177 .BR scalb (3)