| 1 |
'\" t |
| 2 |
.\" Copyright 2004, Andries E. Brouwer <[email protected]> |
| 3 |
.\" Copyright, the authors of the Linux man-pages project |
| 4 |
.\" |
| 5 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 6 |
.\" |
| 7 |
.TH scalb 3 2026-02-08 "Linux man-pages 6.18" |
| 8 |
.SH NAME |
| 9 |
scalb, scalbf, scalbl |
| 10 |
\- |
| 11 |
scale by an integer power of radix (OBSOLETE) |
| 12 |
.SH LIBRARY |
| 13 |
Math library |
| 14 |
.RI ( libm ,\~ \-lm ) |
| 15 |
.SH SYNOPSIS |
| 16 |
.nf |
| 17 |
.B #include <math.h> |
| 18 |
.P |
| 19 |
.BI "[[deprecated]] double scalb(double " x ", double " e ); |
| 20 |
.BI "[[deprecated]] float scalbf(float " x ", float " e ); |
| 21 |
.BI "[[deprecated]] long double scalbl(long double " x ", long double " e ); |
| 22 |
.fi |
| 23 |
.P |
| 24 |
.RS -4 |
| 25 |
Feature Test Macro Requirements for glibc (see |
| 26 |
.BR feature_test_macros (7)): |
| 27 |
.RE |
| 28 |
.P |
| 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 |
| 36 |
.P |
| 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 |
| 47 |
by |
| 48 |
.B FLT_RADIX |
| 49 |
(probably 2) |
| 50 |
to the power of |
| 51 |
.IR e , |
| 52 |
that is: |
| 53 |
.P |
| 54 |
.nf |
| 55 |
x * FLT_RADIX ** e |
| 56 |
.fi |
| 57 |
.P |
| 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 |
| 66 |
* |
| 67 |
.B FLT_RADIX |
| 68 |
** |
| 69 |
.IR e . |
| 70 |
.P |
| 71 |
If |
| 72 |
.I x |
| 73 |
or |
| 74 |
.I e |
| 75 |
is a NaN, a NaN is returned. |
| 76 |
.P |
| 77 |
If |
| 78 |
.I x |
| 79 |
is positive infinity (negative infinity), |
| 80 |
and |
| 81 |
.I e |
| 82 |
is not negative infinity, |
| 83 |
positive infinity (negative infinity) is returned. |
| 84 |
.P |
| 85 |
If |
| 86 |
.I x |
| 87 |
is +0 (\-0), and |
| 88 |
.I e |
| 89 |
is not positive infinity, +0 (\-0) is returned. |
| 90 |
.P |
| 91 |
If |
| 92 |
.I x |
| 93 |
is zero, and |
| 94 |
.I e |
| 95 |
is positive infinity, |
| 96 |
a domain error occurs, and |
| 97 |
a NaN is returned. |
| 98 |
.P |
| 99 |
If |
| 100 |
.I x |
| 101 |
is an infinity, |
| 102 |
and |
| 103 |
.I e |
| 104 |
is negative infinity, |
| 105 |
a domain error occurs, and |
| 106 |
a NaN is returned. |
| 107 |
.P |
| 108 |
If the result overflows, |
| 109 |
a range error occurs, |
| 110 |
and the functions return |
| 111 |
.BR HUGE_VAL , |
| 112 |
.BR HUGE_VALF , |
| 113 |
or |
| 114 |
.BR HUGE_VALL , |
| 115 |
respectively, with a sign the same as |
| 116 |
.IR x . |
| 117 |
.P |
| 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 |
| 123 |
See |
| 124 |
.BR math_error (7) |
| 125 |
for information on how to determine whether an error has occurred |
| 126 |
when calling these functions. |
| 127 |
.P |
| 128 |
The following errors can occur: |
| 129 |
.TP |
| 130 |
Domain error: \f[I]x\f[] is 0, and \f[I]e\f[] is positive infinity, \ |
| 131 |
or \f[I]x\f[] is positive infinity and \f[I]e\f[] 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. |
| 139 |
.TP |
| 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. |
| 147 |
.TP |
| 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). |
| 158 |
.TS |
| 159 |
allbox; |
| 160 |
lbx lb lb |
| 161 |
l l l. |
| 162 |
Interface Attribute Value |
| 163 |
T{ |
| 164 |
.na |
| 165 |
.nh |
| 166 |
.BR scalb (), |
| 167 |
.BR scalbf (), |
| 168 |
.BR scalbl () |
| 169 |
T} Thread safety MT-Safe |
| 170 |
.TE |
| 171 |
.SH STANDARDS |
| 172 |
None. |
| 173 |
.SH HISTORY |
| 174 |
.TP |
| 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), |
| 182 |
or |
| 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) |