malloc.3: ffix
[man-pages.git] / man3 / scalb.3
blob703fe6e60918a127c0866a03b1fcfe80cc0a1b19
1 .\" Copyright 2004 Andries Brouwer <aeb@cwi.nl>.
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 .TH SCALB 3 2021-03-22 "" "Linux Programmer's Manual"
28 .SH NAME
29 scalb, scalbf, scalbl \- multiply floating-point number
30 by integral power of radix (OBSOLETE)
31 .SH SYNOPSIS
32 .nf
33 .B #include <math.h>
34 .PP
35 .BI "double scalb(double " x ", double " exp );
36 .BI "float scalbf(float " x ", float " exp );
37 .BI "long double scalbl(long double " x ", long double " exp );
38 .fi
39 .PP
40 Link with \fI\-lm\fP.
41 .PP
42 .RS -4
43 Feature Test Macro Requirements for glibc (see
44 .BR feature_test_macros (7)):
45 .RE
46 .PP
47 .BR scalb ():
48 .nf
49     _XOPEN_SOURCE >= 500
50 .\"    || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
51         || /* Since glibc 2.19: */ _DEFAULT_SOURCE
52         || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
53 .fi
54 .PP
55 .BR scalbf (),
56 .BR scalbl ():
57 .nf
58     _XOPEN_SOURCE >= 600
59         || /* Since glibc 2.19: */ _DEFAULT_SOURCE
60         || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
61 .fi
62 .SH DESCRIPTION
63 These functions multiply their first argument
64 .I x
66 .B FLT_RADIX
67 (probably 2)
68 to the power of
69 .IR exp ,
70 that is:
71 .PP
72 .nf
73     x * FLT_RADIX ** exp
74 .fi
75 .PP
76 The definition of
77 .B FLT_RADIX
78 can be obtained by including
79 .IR <float.h> .
80 .\" not in /usr/include but in a gcc lib
81 .SH RETURN VALUE
82 On success, these functions return
83 .IR x
85 .B FLT_RADIX
87 .IR exp .
88 .PP
90 .I x
92 .I exp
93 is a NaN, a NaN is returned.
94 .PP
96 .I x
97 is positive infinity (negative infinity),
98 and
99 .I exp
100 is not negative infinity,
101 positive infinity (negative infinity) is returned.
104 .I x
105 is +0 (\-0), and
106 .I exp
107 is not positive infinity, +0 (\-0) is returned.
110 .I x
111 is zero, and
112 .I exp
113 is positive infinity,
114 a domain error occurs, and
115 a NaN is returned.
118 .I x
119 is an infinity,
121 .I exp
122 is negative infinity,
123 a domain error occurs, and
124 a NaN is returned.
126 If the result overflows,
127 a range error occurs,
128 and the functions return
129 .BR HUGE_VAL ,
130 .BR HUGE_VALF ,
132 .BR HUGE_VALL ,
133 respectively, with a sign the same as
134 .IR x .
136 If the result underflows,
137 a range error occurs,
138 and the functions return zero, with a sign the same as
139 .IR x .
140 .SH ERRORS
142 .BR math_error (7)
143 for information on how to determine whether an error has occurred
144 when calling these functions.
146 The following errors can occur:
148 Domain error: \fIx\fP is 0, and \fIexp\fP is positive infinity, \
149 or \fIx\fP is positive infinity and \fIexp\fP is negative infinity \
150 and the other argument is not a NaN
151 .I errno
152 is set to
153 .BR EDOM .
154 An invalid floating-point exception
155 .RB ( FE_INVALID )
156 is raised.
158 Range error, overflow
159 .I errno
160 is set to
161 .BR ERANGE .
162 An overflow floating-point exception
163 .RB ( FE_OVERFLOW )
164 is raised.
166 Range error, underflow
167 .I errno
168 is set to
169 .BR ERANGE .
170 An underflow floating-point exception
171 .RB ( FE_UNDERFLOW )
172 is raised.
173 .SH ATTRIBUTES
174 For an explanation of the terms used in this section, see
175 .BR attributes (7).
176 .ad l
179 allbox;
180 lbx lb lb
181 l l l.
182 Interface       Attribute       Value
184 .BR scalb (),
185 .BR scalbf (),
186 .BR scalbl ()
187 T}      Thread safety   MT-Safe
191 .sp 1
192 .SH CONFORMING TO
193 .BR scalb ()
194 is specified in POSIX.1-2001, but marked obsolescent.
195 POSIX.1-2008 removes the specification of
196 .BR scalb (),
197 recommending the use of
198 .BR scalbln (3),
199 .BR scalblnf (3),
201 .BR scalblnl (3)
202 instead.
204 .BR scalb ()
205 function is from 4.3BSD.
207 .BR scalbf ()
209 .BR scalbl ()
210 are unstandardized;
211 .BR scalbf ()
212 is nevertheless present on several other systems
213 .\" Looking at header files: scalbf() is present on the
214 .\" BSDs, Tru64, HP-UX 11, Irix 6.5; scalbl() is on HP-UX 11 and Tru64.
215 .SH BUGS
216 Before glibc 2.20,
217 .\" http://sources.redhat.com/bugzilla/show_bug.cgi?id=6803
218 .\" http://sources.redhat.com/bugzilla/show_bug.cgi?id=6804
219 these functions did not set
220 .I errno
221 for domain and range errors.
222 .SH SEE ALSO
223 .BR ldexp (3),
224 .BR scalbln (3)