cbrt(), cbrtf(), sqrt(), sqrtf()

cube root and square root functions 

Function


SYNOPSIS

#include <math.h>

double cbrt(double x)

float cbrtf(float x)

double sqrt(double x)

float sqrtf(float x)


DESCRIPTION

The cbrt() and cbrtf() functions compute the cube root of x.

The sqrt() and sqrtf() functions compute the non-negative square root of x.

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

The sqrtf() function is a single-precision version of sqrt(). The cbrtf() function is a single-precision version of cbrt().


PARAMETERS

x 

Is the value whose root is to be computed.


RETURN VALUES

The sqrt() function returns the value of the cube root of x. The sqrt() function returns the value of the cube root of x.

If x is NaN, cbrt() returns NaN. If x is NaN and the current math mode is POSIX, errno is set to EDOM. In SVID or XOPEN mode, the mattherr() is called.

If x is negative, cbrt(x) and sqrt(x) do one of the following based on the current math mode:


CONFORMANCE

sqrt(): ANSI/ISO 9899-1990

sqrtf(): PTC MKS Toolkit UNIX APIs extension


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

At high levels of compiler optimizations, the hardware handles the sqrt() function intrinsically. In such cases, mathematical exceptions do not cause the matherr() function to be called or the errno value to be set.


AVAILABILITY

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


PTC MKS Toolkit 10.4 Documentation Build 39.