share/mk/: Fix includes
[man-pages.git] / man3 / scalb.3
blobb3cc8c2c95f1c2b11ec2055caa364dc0225a2bd4
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 scalb 3 (date) "Linux man-pages (unreleased)"
9 .SH NAME
10 scalb, scalbf, scalbl \- multiply floating-point number
11 by integral power of radix (OBSOLETE)
12 .SH LIBRARY
13 Math library
14 .RI ( libm ", " \-lm )
15 .SH SYNOPSIS
16 .nf
17 .B #include <math.h>
19 .BI "[[deprecated]] double scalb(double " x ", double " exp );
20 .BI "[[deprecated]] float scalbf(float " x ", float " exp );
21 .BI "[[deprecated]] long double scalbl(long double " x ", long double " exp );
22 .fi
24 .RS -4
25 Feature Test Macro Requirements for glibc (see
26 .BR feature_test_macros (7)):
27 .RE
29 .BR scalb ():
30 .nf
31     _XOPEN_SOURCE >= 500
32 .\"    || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
33         || /* Since glibc 2.19: */ _DEFAULT_SOURCE
34         || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
35 .fi
37 .BR scalbf (),
38 .BR scalbl ():
39 .nf
40     _XOPEN_SOURCE >= 600
41         || /* Since glibc 2.19: */ _DEFAULT_SOURCE
42         || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
43 .fi
44 .SH DESCRIPTION
45 These functions multiply their first argument
46 .I x
48 .B FLT_RADIX
49 (probably 2)
50 to the power of
51 .IR exp ,
52 that is:
54 .nf
55     x * FLT_RADIX ** exp
56 .fi
58 The definition of
59 .B FLT_RADIX
60 can be obtained by including
61 .IR <float.h> .
62 .\" not in /usr/include but in a gcc lib
63 .SH RETURN VALUE
64 On success, these functions return
65 .I x
67 .B FLT_RADIX
69 .IR exp .
72 .I x
74 .I exp
75 is a NaN, a NaN is returned.
78 .I x
79 is positive infinity (negative infinity),
80 and
81 .I exp
82 is not negative infinity,
83 positive infinity (negative infinity) is returned.
86 .I x
87 is +0 (\-0), and
88 .I exp
89 is not positive infinity, +0 (\-0) is returned.
92 .I x
93 is zero, and
94 .I exp
95 is positive infinity,
96 a domain error occurs, and
97 a NaN is returned.
100 .I x
101 is an infinity,
103 .I exp
104 is negative infinity,
105 a domain error occurs, and
106 a NaN is returned.
108 If the result overflows,
109 a range error occurs,
110 and the functions return
111 .BR HUGE_VAL ,
112 .BR HUGE_VALF ,
114 .BR HUGE_VALL ,
115 respectively, with a sign the same as
116 .IR x .
118 If the result underflows,
119 a range error occurs,
120 and the functions return zero, with a sign the same as
121 .IR x .
122 .SH ERRORS
124 .BR math_error (7)
125 for information on how to determine whether an error has occurred
126 when calling these functions.
128 The following errors can occur:
130 Domain error: \fIx\fP is 0, and \fIexp\fP is positive infinity, \
131 or \fIx\fP is positive infinity and \fIexp\fP is negative infinity \
132 and the other argument is not a NaN
133 .I errno
134 is set to
135 .BR EDOM .
136 An invalid floating-point exception
137 .RB ( FE_INVALID )
138 is raised.
140 Range error, overflow
141 .I errno
142 is set to
143 .BR ERANGE .
144 An overflow floating-point exception
145 .RB ( FE_OVERFLOW )
146 is raised.
148 Range error, underflow
149 .I errno
150 is set to
151 .BR ERANGE .
152 An underflow floating-point exception
153 .RB ( FE_UNDERFLOW )
154 is raised.
155 .SH ATTRIBUTES
156 For an explanation of the terms used in this section, see
157 .BR attributes (7).
159 allbox;
160 lbx lb lb
161 l l l.
162 Interface       Attribute       Value
166 .BR scalb (),
167 .BR scalbf (),
168 .BR scalbl ()
169 T}      Thread safety   MT-Safe
171 .SH STANDARDS
172 None.
173 .SH HISTORY
175 .BR scalb ()
176 4.3BSD.
177 Obsolescent in POSIX.1-2001;
178 Removed in POSIX.1-2008,
179 recommending the use of
180 .BR scalbln (3),
181 .BR scalblnf (3),
183 .BR scalblnl (3)
184 instead.
185 .\" Looking at header files: scalbf() is present on the
186 .\" BSDs, Tru64, HP-UX 11, Irix 6.5; scalbl() is on HP-UX 11 and Tru64.
187 .SH BUGS
188 Before glibc 2.20,
189 .\" https://www.sourceware.org/bugzilla/show_bug.cgi?id=6803
190 .\" https://www.sourceware.org/bugzilla/show_bug.cgi?id=6804
191 these functions did not set
192 .I errno
193 for domain and range errors.
194 .SH SEE ALSO
195 .BR ldexp (3),
196 .BR scalbln (3)