exp2(3)
β¨ exp2 β base-2 exponential function, but make it cute β¨
okay bestie, so this is the manual page for the math library girls β exp2, exp2f and exp2l π (that's the libm crew, link it with -lm π
). It's giving "2 to the power of x" and honestly? iconic.
πΈ NAME πΈ
exp2, exp2f, exp2l β the base-2 exponential function. that's the whole vibe π¦
π LIBRARY π
Math library (libm, -lm) β yes you gotta add the -lm, no cap, the compiler will literally ghost you otherwise π
β¨ SYNOPSIS β¨
#include <math.h>
double exp2(double x);
float exp2f(float x);
long double exp2l(long double x);
π§ Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
exp2(),exp2f(),exp2l():
_ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
bestie you need one of these defined or the functions just won't show up. gatekeeping fr π
π DESCRIPTION π
These functions return the value of 2 raised to the power of x. that's it. that's the function. 2^x, slay π
β RETURN VALUE β
On success, these functions return the base-2 exponential value of x. so like, the answer. the moment. π
For various special cases β including the handling of infinity and NaN, as well as overflows and underflows β see exp(3). the special-case lore lives over there, go read it bestie, i'm not retyping all that π«Ά
π ERRORS π
See math_error(7) for information on how to determine whether an error has occurred when calling these functions. (tl;dr there's a whole system for checking and math_error(7) is the girl who explains it π)
For a discussion of the errors that can occur for these functions, see exp(3). same deal β all the error discourse is in exp(3)'s house, not here π
π ATTRIBUTES π
For an explanation of the terms used in this section, see attributes(7).
exp2(),exp2f(),exp2l()β Thread safety: MT-Safe π₯
so yeah, thread-safe, you can call these from wherever, it's fine, no drama, periodt β¨
π STANDARDS π
C11, POSIX.1-2008. certified, stamped, official π«Ά
πΈ HISTORY πΈ
glibc 2.1. also C99, POSIX.1-2001. the glow-up timeline fr πβ¨
The variant returning double also conforms to SVr4, 4.3BSD. (that's exp2 specifically β it's been around, it has range π)
π¦ SEE ALSO π¦
reminder bestie:exp2is base 2, not basee. if you wantede^xyou wantexp(3), don't mix them up or the math will be wrong and the vibes will be worse ππ
okay that's the whole page π this was Linux man-pages 6.20, dated 2026-02-08, and it's exp2(3) if you're searching for it later. mwah, go compute something beautiful β¨π
π
π¦ 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 1993, David Metcalfe <david@prism.demon.co.uk>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms