1scalb(3) Library Functions Manual scalb(3)
2
3
4
6 scalb, scalbf, scalbl - multiply floating-point number by integral
7 power of radix (OBSOLETE)
8
10 Math library (libm, -lm)
11
13 #include <math.h>
14
15 [[deprecated]] double scalb(double x, double exp);
16 [[deprecated]] float scalbf(float x, float exp);
17 [[deprecated]] long double scalbl(long double x, long double exp);
18
19 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
20
21 scalb():
22 _XOPEN_SOURCE >= 500
23 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
24 || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
25
26 scalbf(), scalbl():
27 _XOPEN_SOURCE >= 600
28 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
29 || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
30
32 These functions multiply their first argument x by FLT_RADIX (probably
33 2) to the power of exp, that is:
34
35 x * FLT_RADIX ** exp
36
37 The definition of FLT_RADIX can be obtained by including <float.h>.
38
40 On success, these functions return x * FLT_RADIX ** exp.
41
42 If x or exp is a NaN, a NaN is returned.
43
44 If x is positive infinity (negative infinity), and exp is not negative
45 infinity, positive infinity (negative infinity) is returned.
46
47 If x is +0 (-0), and exp is not positive infinity, +0 (-0) is returned.
48
49 If x is zero, and exp is positive infinity, a domain error occurs, and
50 a NaN is returned.
51
52 If x is an infinity, and exp is negative infinity, a domain error oc‐
53 curs, and a NaN is returned.
54
55 If the result overflows, a range error occurs, and the functions return
56 HUGE_VAL, HUGE_VALF, or HUGE_VALL, respectively, with a sign the same
57 as x.
58
59 If the result underflows, a range error occurs, and the functions re‐
60 turn zero, with a sign the same as x.
61
63 See math_error(7) for information on how to determine whether an error
64 has occurred when calling these functions.
65
66 The following errors can occur:
67
68 Domain error: x is 0, and exp is positive infinity, or x is positive
69 infinity and exp is negative infinity and the other argument is not a
70 NaN
71 errno is set to EDOM. An invalid floating-point exception
72 (FE_INVALID) is raised.
73
74 Range error, overflow
75 errno is set to ERANGE. An overflow floating-point exception
76 (FE_OVERFLOW) is raised.
77
78 Range error, underflow
79 errno is set to ERANGE. An underflow floating-point exception
80 (FE_UNDERFLOW) is raised.
81
83 For an explanation of the terms used in this section, see at‐
84 tributes(7).
85
86 ┌────────────────────────────────────────────┬───────────────┬─────────┐
87 │Interface │ Attribute │ Value │
88 ├────────────────────────────────────────────┼───────────────┼─────────┤
89 │scalb(), scalbf(), scalbl() │ Thread safety │ MT-Safe │
90 └────────────────────────────────────────────┴───────────────┴─────────┘
91
93 None.
94
96 scalb()
97 4.3BSD. Obsolescent in POSIX.1-2001; Removed in POSIX.1-2008,
98 recommending the use of scalbln(3), scalblnf(3), or scalblnl(3)
99 instead.
100
102 Before glibc 2.20, these functions did not set errno for domain and
103 range errors.
104
106 ldexp(3), scalbln(3)
107
108
109
110Linux man-pages 6.05 2023-07-20 scalb(3)