CBRT(3,L) AIX Technical Reference CBRT(3,L) ------------------------------------------------------------------------------- cbrt, exp, expm1, log, log10, log1p, pow, sqrt PURPOSE Computes exponential, logarithm, power, square root and cube root functions. LIBRARY Math Library (libm.a) SYNTAX #include double cbrt (x) double log10 (x) double x; double x; double exp (x) double log1p (x) double x; double x; double expm1 (x) double pow (x, y) double x; double x, y; double log (x) double sqrt (x) double x; double x; DESCRIPTION The cbrt subroutine returns the cube root of x. The exp subroutine to returns e(x). The expm1 subroutine returns log (1+x). The log subroutine returns the natural logarithm of x, ln x . The value of x must be positive. The log10 subroutine returns the logarithm base 10 of x, log sub 10 % x . The value of x must be positive. The log1p subroutine returns log (1+x). Processed November 7, 1990 CBRT(3,L) 1 CBRT(3,L) AIX Technical Reference CBRT(3,L) The pow subroutine returns x(y). The values of x and y may not both be 0. If x is negative or 0, then y must be an integer. The sqrt subroutine returns the square root of x. The value of x cannot be negative. Note: The expm1 and log1p subroutines are useful to guarantee that financial calculations of ((1+x(n)-1/ x (expm1(n* log1p (x))/x are accurate when x is very small (for example, small daily interest rates). They also make it easier to write accurate inverse hyperbolic functions. ERROR CONDITIONS The exp, log, log10, and sqrt subroutines can perform either of the following types of error handling. The pow subroutine always handles errors according to the second method. Both types of error handling allow you to define special actions to be taken when an error occurs. 1. For cbrt, exp, log, log10, and sqrt, exception handling will be performed according to ANSI/IEEE standard 754 for binary floating-point arithmetic by default. If a hardware floating-point processor is installed in your system, then using this option can provide greater performance in addition to IEEE exception handling. This mode instructs the C compiler to generate code that avoids the overhead of the math library subroutines by generating math coprocessor code in-line. 2. The second method is matherr error handling, as described on page matherr-1. The default error-handling procedures for these subroutines are as follows: cbrt If x is negative, cbrt returns the value 0, sets errno to EDOM and writes an error message to the standard error output. exp If the correct value overflows, exp returns HUGE and sets errno to ERANGE. expm1 If the correct value overflows, expm1 returns HUGE but does not modify errno. log If x is negative or 0, log returns the value -HUGE, sets errno to EDOM if x is negative and to ERANGE if x is 0, and writes an error message to the standard error output. log10 If x is negative or 0, log10 returns the value -HUGE, sets errno to EDOM if x is negative and to ERANGE if x is 0, and writes an error message to the standard error output. Processed November 7, 1990 CBRT(3,L) 2 CBRT(3,L) AIX Technical Reference CBRT(3,L) log1p If x is less than -1, then log1p returns the value QNaN. If x equals -1, then log1p returns the value -HUGE. In neither case is errno set. pow If x is negative or 0 and y is not an integer, or if x and y are both 0, pow returns the value 0, sets errno to EDOM, and writes an error message to the standard error output. If the correct value overflows, pow returns HUGE and sets errno to ERANGE. sqrt If x is negative, sqrt returns the value 0, sets errno to EDOM, and writes an error message to the standard error output. This second method of error handling is invoked by including the -z option on the cc command line. RELATED INFORMATION In this book: "hypot, cabs," "matherr," and "sinh, cosh, tanh." Processed November 7, 1990 CBRT(3,L) 3