exp(3m) — RISC
Name
exp, expm1, log, log10, log1p, pow − exponential, logarithm, power
Syntax
#include <math.h>
double exp(x)
double x;
float fexp(x)
float x;
double expm1(x)
double x;
float fexpm1(x)
float x;
double log(x)
double x;
float flog(x)
float x;
double log10(x)
double x;
float flog10(x)
float x;
double log1p(x)
double x;
float flog1p(x)
float x;
double pow(x,y)
double x,y;
Description
The exp and fexp functions return the exponential function of x for double and float data types, respectively.
The expm1 and fexpm1 functions return exp(x)-1 accurately, including tiny x for double and float data types, respectively.
The log and flog functions return the natural logarithm of x for double and float data types, respectively.
The log10 and flog10 functions return the logarithm of x to base 10 for double and float data types, respectively.
The log1p and flog1p functions return log(1+x) accurately, including tiny x for double and float data types, respectively.
The pow function returns x**y.
Error (due to roundoff)
The exp, log, expm1, and log1p functions are accurate to within an ulp, and log10 is accurate to within approximately 2 ulps; an ulp is one Unit in the Last Place.
The pow function is accurate to within 2 ulps when its magnitude is moderate, but becomes less accurate as the pow result approaches the overflow or underflow thresholds. Theoretically, as these thresholds are approached, almost as many bits could be lost from the result as are indicated in the exponent field of the floating-point format for the resultant number. In other words, up to 11 bits for an IEEE 754 double-precision floating-point number. However, testing has never verified loss of precision as drastic as 11 bits. The worst cases have shown accuracy of results to within 300 ulps for IEEE 754 double-precision floating-point numbers. In general, a pow (integer, integer) result is exact until it is larger than 2**53 (for IEEE 754 double-precision floating-point).
Return Value
All of the double precision functions return NaN if x or y is NaN.
The exp function returns HUGE_VAL when the correct value would overflow, and zero when the correct value would underflow.
The log and log10 functions return NaN when x is less than or equal to zero or when the correct value would overflow.
The pow function returns NaN if x or y is NaN. When both x and y are zero, 1.0 is returned. When x is negative and y is not an integer, NaN is returned. If x is zero and y is negative, -HUGE_VAL is returned.
The sqrt function returns NaN when x is negative.