# pow(), powf()compute x to the power of y

## SYNOPSIS

#include <math.h>

double pow(double x, double y)

float powf(float x, float y)

## DESCRIPTION

The pow() function computes x raised to the power y. If x is negative, y must be an integer value.

To check for errors, set errno to 0 before calling pow(). If errno is non-zero on return, or the return value is NaN, an error has occurred.

The powf() function is a single-precision version of pow().

x

Is the mantissa.

y

Is the exponent.

## RETURN VALUES

The pow() function returns the value of x**y.

If x is 0.0 and y is 0.0, 1.0 is returned unless in SVID mode, in which case 0.0 is returned and matherr() is called.

If x is 0.0 and y is negative, then:

• In IEEE mode, a value of Infinity is returned.

• In POSIX mode, errno is set to EDOM and -Infinity is returned.

• In SVID mode, matherr() is called and a value of 0 is returned.

• In XOPEN mode, matherr() is called and a value of -Infinity is returned.

If x is NaN and y is zero, then:

• In IEEE or POSIX mode, a value of 1.0 is returned.

• In SVID or XOPEN mode, a value of NaN is returned and matherr() is called.

If y is NaN or y is non-zero and x is NaN, NaN is returned.

If y is 0.0 and x is NaN, then:

• In IEEE or POSIX mode, a value of 1.0 is returned.

• In SVID or XOPEN mode, a value of NaN is returned and matherr() is called.

If x is negative and y is a non-integer, then:

• In IEEE mode, NaN is returned.

• In POSIX mode, NaN is returned and errno is set to EDOM.

• In SVID mode, 0 is returned and matherr() is called.

• In XOPEN mode, NaN is returned and matherr() is called.

If it overflows, then:

• In IEEE mode, Inf is returned.

• In POSIX mode, Inf is returned and errno is set to ERANGE.

• In SVID mode, ±HUGE_VAL is returned and matherr() is called.

• In XOPEN mode, Inf is returned and matherr() is called.

If it underflows, 0.0 is returned and:

• In POSIX mode, errno is set to ERANGE.

• In SVID or XOPEN mode, matherr() is called.

## CONFORMANCE

pow(): ANSI/ISO 9899-1990

powf(): PTC MKS Toolkit UNIX APIs extension

MT-Safe.

None.

## AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition