exp(S) 6 January 1993 exp(S) Name exp, log, log10, pow, sqrt - exponential, logarithm, power, square root functions Syntax cc . . . -lm #include <math.h> double exp (x) double x; double log (x) double x; double log10 (x) double x; double pow (x, y) double x, y; double sqrt (x) double x; Description The exp function returns e^x. The log function returns the natural logarithm of x. The value of x must be positive. The log10 function returns the logarithm base ten of x. The value of x must be positive. The pow function returns x^y. If x is zero, y must be positive. If x is negative, y must be an integer. The sqrt function returns the non-negative square root of x. The value of x cannot be negative. See also hypot(S), matherr(S), sinh(S) Diagnostics The exp function returns HUGE when the correct value would overflow, or 0 when the correct value would underflow, and sets errno to ERANGE. The log and log10 functions return -HUGE and set errno to EDOM when x is non-positive. A message indicating DOMAIN error (or SING error when x is 0) is printed on the standard error output. Ihe pow function returns 0 and sets errno to EDOM when x is 0 and y is non-positive, or when x is negative and y is not an integer. In these cases a message indicating DOMAIN error is printed on the standard error output. When the correct value for pow would overflow or underflow, pow returns +-HUGE or 0 respectively, and sets errno to ERANGE. The sqrt returns 0 and sets errno to EDOM when x is negative. A message indicating DOMAIN error is printed on the standard error output. These error-handling procedures may be changed with the function matherr. Standards conformance exp is conformant with: AT&T SVID Issue 2; X/Open Portability Guide, Issue 3, 1989; IEEE POSIX Std 1003.1-1990 System Application Program Interface (API) [C Language] (ISO/IEC 9945-1); and NIST FIPS 151-1. log, log10, pow and sqrt are conformant with: AT&T SVID Issue 2; X/Open Portability Guide, Issue 3, 1989; ANSI X3.159-1989 Programming Language -- C; IEEE POSIX Std 1003.1-1990 System Application Program Interface (API) [C Language] (ISO/IEC 9945-1); and NIST FIPS 151-1.