exp(3) — Subroutines
NAME
exp, expm1, log, log2, log10, log1p, pow − Exponential, logarithm, and power functions
LIBRARY
Math Library (libm.a)
SYNOPSIS
#include <math.h>
double exp (double x);
float expf (float x);
double expm1 (double x);
float expm1f (float x);
double log (double x);
float logf (float x);
double log2 (double x);
float log2f (float x);
double log10 (double x);
float log10f (float x);
double log1p (double y);
float log1pf (float y);
double pow (double x, double y);
float powf (float x, float y);
STANDARDS
Interfaces documented on this reference page conform to industry standards as follows:
exp(): XPG4
expm1(): XPG4−UNIX
log(): XPG4
log10(): XPG4
log1p(): XPG4−UNIX
pow(): XPG4
Refer to the standards(5) reference page for more information about industry standards and associated tags.
DESCRIPTION
The exp() and expf() functions compute the value of the exponential function, defined as e∗∗x, where e is the constant used as a base for natural logarithms.
The expm1() and expm1f() functions compute exp(x) − 1 accurately, even for tiny x.
The log() and logf() functions compute the natural (base e) logarithm of x.
The log2() and log2f() functions compute the base 2 logarithm of x.
The log10() and log10f() functions compute the common (base 10) logarithm of x.
The log1p() and log1pf() functions compute log(1+y) accurately, even for tiny y.
The pow() and powf() functions raise a floating-point base x to a floating-point exponent y. The value of pow(x,y) is computed as e∗∗(y ln(x)) for positive x. If x is 0 or negative, see your language reference manual.
Passing a NaN input value to pow() produces a NaN result for y not equal to 0. For pow(NaN,0), see your language reference manual.
The following table describes function behavior in response to exceptional arguments:
| Function | Exceptional Argument | Routine Behavior |
| exp(), expf() | x > ln(max_float) | Overflow |
| exp(), expf() | x < ln(min_float) | Underflow |
| expm1(), expm1f() | x > ln(max_float) | Overflow |
| expm1(), expm1f() | x < ln(min_float) | Underflow |
| log(), logf() | x < 0 | Invalid argument |
| log(), logf() | x = 0 | Overflow |
| log2(), log2f() | x < 0 | Invalid argument |
| log2(), logf2() | x = 0 | Overflow |
| log10(), log10f() | x < 0 | Invalid argument |
| log10(), log10f() | x = 0 | Overflow |
| log1p(), log1pf() | 1+y < 0 | Invalid argument |
| log1p(), log1pf() | 1+y = 0 | Overflow |
| pow(), powf() | y ln(x) > ln(max_float) | Overflow |
| pow(), powf() | y ln(x) < ln(min_float) | Underflow |
The following table lists boundary values used by these functions:
| Value | Data | Hexadecimal Value | Decimal Value |
| Name | Type | ||
| ln(max_float) | S_FLOAT | 42B17218 | 88.7228391 |
| T_FLOAT | 40862E42FEFA39EF | 709.7827128933840 | |
| ln(min_float) | S_FLOAT | C2CE8ED0 | -103.2789 |
| T_FLOAT | C0874385446D71C3 | -744.4400719213813 |