Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ exp(3m) — Ultrix/UWS 4.0 VAX

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

hypot(3m)

intro(3m)

sinh(3m)

exp(3m)  —  VAX

Name

exp, expm1, log, log10, log1p, pow, sqrt − exponential, logarithm, power, square root

Syntax

#include <math.h>

double exp(x)
double x;

double expm1(x)
double x;

double log(x)
double x;

double log10(x)
double x;

double log1p(x)
double x;

double pow(x,y)
double x,y;

double sqrt(x)
double x;

Description

The exp function returns the exponential function of x. 

The expm1 function returns exp(x)-1 accurately even for tiny x.

The log function returns the natural logarithm of x; log10 returns the base 10 logarithm.

The log1p function returns log(1+x) accurately even for tiny x.

The pow function returns x raised to the y power. 

The sqrt function returns the square root of x. 

Return Value

The exp function returns HUGE_VAL and sets errno to ERANGE when the correct value would overflow.  When the correct value would underflow it returns zero and errno is set to ERANGE. 

The expm1 function returns HUGE_VAL and sets errno to ERANGE when the correct value would overflow.  When the correct value would underflow it returns -1. 

The log and log10 functions return -HUGE_VAL and set errno to EDOM when x is less than or equal to zero.  When the correct value would overflow flow they return -HUGE_VAL and errno is set to ERANGE. 

The log1p function returns -HUGE_VAL and sets errno to EDOM when x is less than or equal to -1.  When the correct value would overflow flow it returns -HUGE_VAL and errno is set to ERANGE. 

The pow function has many special cases. When x and y are both zero it returns 1.0.  When x is negative and y is not an integer value it returns zero and errno is set to EDOM.  When x is zero and y is negative it returns -HUGE_VAL and errno is set to EDOM.  When the correct value would overflow HUGE_VAL is returned and errno is set to ERANGE.  When the correct value would underflow zero is returned and errno is set to ERANGE. 

The sqrt function returns zero and sets errno to EDOM when x is negative. 

Environment

When your program is compiled using the System V environment, exp returns HUGE when the correct value would overflow, and sets errno to ERANGE; exp returns zero 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 nonpositive.  An error message is printed on the standard error output. 

The pow function returns zero and sets errno to EDOM when x is non-positive and y is not an integer, or when x and y are both zero.  In these cases, a message indicating DOMAIN error is printed on the standard error output.  When the correct value for pow would overflow, pow returns HUGE and sets errno to ERANGE. 

The sqrt function returns zero 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(.).

Note

DOMAIN error is only printed in the System V environment. 

See Also

hypot(3m), intro(3m), sinh(3m)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026