NAME
cbrt, cbrtf, cbrtl, rsqrt, rsqrtf, rsqrtl, sqrt, sqrtf, sqrtl – cube root, square root, and inverse square root functions
LIBRARY
Math Library (libm, -lm)
SYNOPSIS
#include <math.h>
double
cbrt(double x);
float
cbrtf(float x);
long double
cbrtl(long double x);
double
rsqrt(double x);
float
rsqrtf(float x);
long double
rsqrtl(long double x);
double
sqrt(double x);
float
sqrtf(float x);
long double
sqrtl(long double x);
DESCRIPTION
The cbrt(), cbrtf(), and cbrtl() functions compute the cube root of x.
The rsqrt(), rsqrtf(), and rsqrtl() functions compute the inverse square root of x.
The sqrt(), sqrtf(), and sqrtl() functions compute the non-negative square root of x.
RETURN VALUES
The cbrt(), cbrtf(), and cbrtl() functions return the requested cube root.
The rsqrt(), rsqrtf(), and rsqrtl() functions return 1 divided by the square root of x unless an error occurs. An attempt to take the rsqrt() of negative x raises an invalid exception and causes an to be returned. The inverse square root of 0 returns ∞ and raises a divide-by-zero exception.
The sqrt(), sqrtf(), and sqrtl() functions return the requested square root unless an error occurs. An attempt to take the sqrt() of negative x raises an invalid exception and causes an to be returned (except that the square root of -0 is valid and equal to -0.)
SEE ALSO
STANDARDS
The cbrt(), cbrtf(), cbrtl(), sqrt(), sqrtf(), and sqrtl() functions conform to ISO/IEC 9899:1999 (“ISO C99”). The rsqrt(), rsqrtf(), and rsqrtl() functions conform to ISO/IEC 9899:2024 ("ISO C23").
HISTORY
The cbrt() function appeared in 4.3BSD. The sqrt() function appeared in Version 2 AT&T UNIX. sqrtl() function appeared in FreeBSD 8.0. The cbrtl() function appeared in FreeBSD 9.0. The rsqrt(), rsqrtf(), and rsqrtl() functions appeared in FreeBSD 16.0.