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