scalbln(3)

πŸ’– scalbln(3) πŸ’–

okay so bestie, welcome to the scalbln(3) page from the Library Functions Manual β€” yes she's a real one, she lives in the math library, and she is here to scale your numbers by an integer power of radix. slay. let's get into it πŸ’…


✨ NAME ✨

scalbn, scalbnf, scalbnl, scalbln, scalblnf, scalblnl β€” scale by an integer power of radix πŸŽ€


πŸ“š LIBRARY πŸ“š

Math library (libm, -lm). yeah you gotta link her. don't forget -lm or she Will Not Show Up. 😭


🌸 SYNOPSIS 🌸

#include <math.h>

double scalbln(double x, long e);
float scalblnf(float x, long e);
long double scalblnl(long double x, long e);

double scalbn(double x, int e);
float scalbnf(float x, int e);
long double scalbnl(long double x, int e);

πŸ¦‹ Feature Test Macro Requirements for glibc πŸ¦‹

(for the deets, go see feature_test_macros(7) β€” she explains everything)

scalbln(), scalblnf(), scalblnl():

_ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
    || /* Since glibc 2.19: */ _DEFAULT_SOURCE

scalbn(), scalbnf(), scalbnl():

_ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
    || /* Since glibc 2.19: */ _DEFAULT_SOURCE
    || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE

πŸ‘‘ DESCRIPTION πŸ‘‘

so what do these girlies actually do? they take your first argument x and multiply it by FLT_RADIX (which is probably 2, like, statistically) raised to the power of e. that's it. that's the whole vibe:

x * FLT_RADIX ** e

and where does FLT_RADIX come from, you ask? you just #include <float.h> and she's right there. main character energy. ✨


🫢 RETURN VALUE 🫢

  • when everything goes right, you get x * FLT_RADIX ** e. periodt.
  • if x is a NaN, a NaN comes back. (NaN in, NaN out, it's giving consistency πŸ’€)
  • if x is positive infinity (or negative infinity), you get positive infinity (or negative infinity) right back. she mirrors, she returns.
  • if x is +0 (or -0), you get +0 (or -0) back. zero stays zero, iconic.
  • if the result overflows, that's a range error, and you get HUGE_VAL, HUGE_VALF, or HUGE_VALL respectively β€” with the same sign as x. big. HUGE even. 😭
  • if the result underflows, also a range error, and you get zero β€” again, same sign as x.

πŸ”₯ ERRORS πŸ”₯

want to know if something went wrong when you called these? go read math_error(7), she'll walk you through it.

here's what can happen:

  • Range error, overflow β€” an overflow floating-point exception (FE_OVERFLOW) gets raised.
  • Range error, underflow β€” errno gets set to ERANGE, and an underflow floating-point exception (FE_UNDERFLOW) gets raised.

🌈 ATTRIBUTES 🌈

for what all these terms even mean, check attributes(7) β€” she's the glossary bestie.

  • scalbn(), scalbnf(), scalbnl(), scalbln(), scalblnf(), scalblnl() β€” Thread safety: MT-Safe πŸŽ‰

(yes, all six of them, same row, same fortune. we love a collective slay.)


⭐ STANDARDS ⭐

C11, POSIX.1-2008. certified, official, no notes. πŸ’…


πŸŽ€ HISTORY πŸŽ€

glibc 2.1. C99, POSIX.1-2001.


πŸŽ€ HISTORY πŸŽ€

(yes there's two HISTORY sections, bestie, the page just has range like that)

so here's the tea: these functions are different from the obsolete ones described over in scalb(3), and the difference is the type of their second argument. the functions on this page have a second argument of an integral type, while the ones in scalb(3) have a second argument of type double. that's the whole distinction. iykyk. 🧚


πŸ’œ NOTES πŸ’œ

if FLT_RADIX equals 2 (which is, like, the usual situation), then scalbn() is equivalent to ldexp(3). cute little crossover episode. πŸ¦‹


πŸ’€ BUGS πŸ’€

before glibc 2.20, these functions did not set errno for range errors. so if you're on an ancient glibc and you're checking errno... yeah. she wasn't doing that yet. πŸ™ˆ


🌟 SEE ALSO 🌟


and that's the whole page, bestie!! so much love to the Linux man-pages 6.20 girlies and their 2026-02-08 drop β€” go forth and scale responsibly πŸ«ΆπŸŒΈπŸ’–βœ¨

πŸ“¦ 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
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms