scalb(3)
π scalb(3) β bestie, it's giving "obsolete but iconic"
okay so real talk: this page is for scalb, scalbf, and scalbl, and the girls are OBSOLETE. Like, the NAME line literally says so. But we still respect them, so here's everything, no gatekeeping. π«Ά
π LIBRARY
Math library β you link it with -lm, obviously. π
β¨ SYNOPSIS β¨
#include <math.h>
[[deprecated]] double scalb(double x, double e);
[[deprecated]] float scalbf(float x, float e);
[[deprecated]] long double scalbl(long double x, long double e);
π notice all three of them carry the [[deprecated]] tag. they know.
π§ Feature Test Macro Requirements for glibc (like, go read feature_test_macros(7) bestie)
scalb():
_XOPEN_SOURCE >= 500
|| /* Since glibc 2.19: */ _DEFAULT_SOURCE
|| /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
scalbf(), scalbl():
_XOPEN_SOURCE >= 600
|| /* Since glibc 2.19: */ _DEFAULT_SOURCE
|| /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
πΈ DESCRIPTION πΈ
so these functions take your first argument x and multiply it by FLT_RADIX (which is probably 2, iykyk) raised to the power of e. in math-girl terms:
x * FLT_RADIX ** e
and if you wanna know what FLT_RADIX actually is on your machine, just #include <float.h> and it will tell you. slay. β¨
π RETURN VALUE π
- On success? You get
x * FLT_RADIX ** e. that's the whole dream. π - If
xoreis a NaN, a NaN comes back. not me getting NaN back π - If
xis positive infinity (negative infinity), andeis not negative infinity, then positive infinity (negative infinity) is returned. π - If
xis+0(-0), andeis not positive infinity, you get+0(-0). the sign is preserved, periodt. - If
xis zero, andeis positive infinity β domain error, and a NaN is returned. π - If
xis an infinity, andeis negative infinity β domain error, and a NaN is returned. π - If the result overflows, it's a range error, and these functions return
HUGE_VAL,HUGE_VALF, orHUGE_VALL, respectively β with a sign the same asx. π₯ - If the result underflows, it's a range error, and the functions return zero, with a sign the same as
x. π¦
π¨ ERRORS π¨
how do you even know if something went sideways? go read math_error(7), she explains the whole detecting-errors thing.
here's what can happen:
- Domain error:
xis 0, andeis positive infinity, orxis positive infinity andeis negative infinity and the other argument is not a NaN βerrnogets set toEDOM, and an invalid floating-point exception (FE_INVALID) is raised. π - Range error, overflow β
errnogets set toERANGE, and an overflow floating-point exception (FE_OVERFLOW) is raised. π - Range error, underflow β
errnogets set toERANGE, and an underflow floating-point exception (FE_UNDERFLOW) is raised. π
π ATTRIBUTES π
if the vocab in this section is confusing you, attributes(7) has the glossary, bestie.
scalb(),scalbf(),scalbl()β Thread safety: MT-Safe. she's safe to share, no cap. π«Ά
β STANDARDS β
None.
...yeah. that's it. that's the whole section. π
π°οΈ HISTORY π°οΈ
scalb()
4.3BSD.- Obsolescent in
POSIX.1-2001. - Removed in
POSIX.1-2008, which recommended usingscalbln(3),scalblnf(3), orscalblnl(3)instead. (basically: she got gently retired and they handed her job to her cousins. respecting the legacy tho. π)
π BUGS π
Before glibc 2.20, these functions did not set errno for domain and range errors. so if you were checking errno back in the day... yeah, nothing was there. π
π¦ SEE ALSO π¦
quick vibe check: this whole page is about functions that are literally marked[[deprecated]]and got removed from POSIX.1-2008. use them if you must, but the recommended glow-up isscalbln(3)/scalblnf(3)/scalblnl(3). π
<style>okay that's the whole page!!</style> written up in Linux man-pages 6.20, dated 2026-02-08, and yes the page you just read is scalb(3). mwah, go touch some floating point π§β¨π
π¦ where this page comes from
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- π the page's license: Linux-man-pages-copyleft
- Copyright 2004, Andries E. Brouwer <aeb@cwi.nl>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms