EXP(3M)
NAME
exp, log, log10, pow, sqrt − exponential, logarithm, power, square root functions
SYNOPSIS
#include <math.h>
double exp (x) float fexp (x)
double x;‡float x;
double log (x) float flog (x)
double x;‡float x;
double log10 (x) float flog10 (x)
double x;‡float x;
double pow (x, y) float fpow
double x, y;‡float x,y;
double sqrt (x) float fsqrt (x)
double x;‡float x;
‡ see important note below
HP-UX COMPATIBILITY
Level: HP-UX/RUN ONLY
Origin: System V
DESCRIPTION
Exp returns ex.
Log returns the natural logarithm of x. The value of x must be positive.
Log10 returns the logarithm base ten of x. The value of x must be positive.
Pow returns xy. If x is zero, y must be positive. If x is negative, y must be an integer.
Sqrt returns the non-negative square root of x. The value of x may not be negative.
IMPORTANT NOTE: The corresponding single-precision routines fexp, flog, flog10, fpow, and fsqrt expect true single-precision arguments, and therefore cannot be called from standard C. They are provided for support of FORTRAN and Pascal.
HARDWARE DEPENDENCIES
Series 200/500:
The algorithms used are those from HP 9000 BASIC.
DIAGNOSTICS
Exp sets errno to ERANGE and returns HUGE when the correct value would overflow, or 0 when the correct value would underflow.
Log and log10 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.
Pow 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.
Sqrt returns 0 and sets errno to EDOM when x is negative. A message indicating DOMAIN error is printed on the standard error output.
Error handling is identical for both single- and double-precision routines, except for one consideration: In any situation where the double-precision routine would return ±HUGE, the corresponding single-precision routine returns ±MAXFLOAT.
These error-handling procedures may be changed with the function matherr(3M).
SEE ALSO
hypot(3M), matherr(3M), sinh(3M).
Hewlett-Packard — last mod. May 11, 2021