| 1 |
'\" t |
| 2 |
.\" Copyright 1993, David Metcalfe <[email protected]> |
| 3 |
.\" Copyright, the authors of the Linux man-pages project |
| 4 |
.\" |
| 5 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 6 |
.\" |
| 7 |
.TH exp 3 2026-02-08 "Linux man-pages 6.18" |
| 8 |
.SH NAME |
| 9 |
exp, expf, expl \- base-e exponential function |
| 10 |
.SH LIBRARY |
| 11 |
Math library |
| 12 |
.RI ( libm ,\~ \-lm ) |
| 13 |
.SH SYNOPSIS |
| 14 |
.nf |
| 15 |
.B #include <math.h> |
| 16 |
.P |
| 17 |
.BI "double exp(double " x ); |
| 18 |
.BI "float expf(float " x ); |
| 19 |
.BI "long double expl(long double " x ); |
| 20 |
.fi |
| 21 |
.P |
| 22 |
.RS -4 |
| 23 |
Feature Test Macro Requirements for glibc (see |
| 24 |
.BR feature_test_macros (7)): |
| 25 |
.RE |
| 26 |
.P |
| 27 |
.BR expf (), |
| 28 |
.BR expl (): |
| 29 |
.nf |
| 30 |
_ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L |
| 31 |
|| /* Since glibc 2.19: */ _DEFAULT_SOURCE |
| 32 |
|| /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE |
| 33 |
.fi |
| 34 |
.SH DESCRIPTION |
| 35 |
These functions return the value of e (the base of natural |
| 36 |
logarithms) raised to the power of |
| 37 |
.IR x . |
| 38 |
.SH RETURN VALUE |
| 39 |
On success, these functions return the exponential value of |
| 40 |
.IR x . |
| 41 |
.P |
| 42 |
If |
| 43 |
.I x |
| 44 |
is a NaN, |
| 45 |
a NaN is returned. |
| 46 |
.P |
| 47 |
If |
| 48 |
.I x |
| 49 |
is positive infinity, |
| 50 |
positive infinity is returned. |
| 51 |
.P |
| 52 |
If |
| 53 |
.I x |
| 54 |
is negative infinity, |
| 55 |
+0 is returned. |
| 56 |
.P |
| 57 |
If the result underflows, |
| 58 |
a range error occurs, |
| 59 |
and zero is returned. |
| 60 |
.P |
| 61 |
If the result overflows, |
| 62 |
a range error occurs, |
| 63 |
and the functions return |
| 64 |
.RB + HUGE_VAL , |
| 65 |
.RB + HUGE_VALF , |
| 66 |
or |
| 67 |
.RB + HUGE_VALL , |
| 68 |
respectively. |
| 69 |
.SH ERRORS |
| 70 |
See |
| 71 |
.BR math_error (7) |
| 72 |
for information on how to determine whether an error has occurred |
| 73 |
when calling these functions. |
| 74 |
.P |
| 75 |
The following errors can occur: |
| 76 |
.TP |
| 77 |
Range error, overflow |
| 78 |
.I errno |
| 79 |
is set to |
| 80 |
.BR ERANGE . |
| 81 |
An overflow floating-point exception |
| 82 |
.RB ( FE_OVERFLOW ) |
| 83 |
is raised. |
| 84 |
.TP |
| 85 |
Range error, underflow |
| 86 |
.I errno |
| 87 |
is set to |
| 88 |
.BR ERANGE . |
| 89 |
An underflow floating-point exception |
| 90 |
.RB ( FE_UNDERFLOW ) |
| 91 |
is raised. |
| 92 |
.SH ATTRIBUTES |
| 93 |
For an explanation of the terms used in this section, see |
| 94 |
.BR attributes (7). |
| 95 |
.TS |
| 96 |
allbox; |
| 97 |
lbx lb lb |
| 98 |
l l l. |
| 99 |
Interface Attribute Value |
| 100 |
T{ |
| 101 |
.na |
| 102 |
.nh |
| 103 |
.BR exp (), |
| 104 |
.BR expf (), |
| 105 |
.BR expl () |
| 106 |
T} Thread safety MT-Safe |
| 107 |
.TE |
| 108 |
.SH STANDARDS |
| 109 |
C11, POSIX.1-2008. |
| 110 |
.SH HISTORY |
| 111 |
C99, POSIX.1-2001. |
| 112 |
.P |
| 113 |
The variant returning |
| 114 |
.I double |
| 115 |
also conforms to |
| 116 |
SVr4, 4.3BSD, C89. |
| 117 |
.SH SEE ALSO |
| 118 |
.BR cbrt (3), |
| 119 |
.BR cexp (3), |
| 120 |
.BR exp10 (3), |
| 121 |
.BR exp2 (3), |
| 122 |
.BR expm1 (3), |
| 123 |
.BR sqrt (3) |