sqrt(3M)
sqrt, fsqrt, sqrtf, sqrtl, cbrt, cbrtl - cube root, square root
As shipped in IRIX 6.5.15. Last changed in IRIX 6.5.5.
NAME sqrt, fsqrt, sqrtf, sqrtl, cbrt, cbrtl - cube root, square root SYNOPSIS #include <math.h> double sqrt(double x); float fsqrt(float x); float sqrtf(float x); long double sqrtl(long double x); double cbrt(double x); long double cbrtl(long double x); IMPLEMENTATION IRIX systems DESCRIPTION The single-precision and long double-precision routines listed above are only available in the standard math library, -lm, and in -lmx. The sqrt functions return the nonnegative square root of their single argument x. The function sqrt both accepts and returns values of type double. The functions fsqrt and sqrtf accept and return float values. The function sqrtl both accepts and returns values of type long double. A fast version of sqrt and fsqrt which are slightly less accurate are available in the library -lfastm. On MIPS2 and newer processors, those routines are identical to the ones in libm.a, because there are hardware square root instructions. The cbrt functions return the cube root of their single argument x. The function cbrt both accepts and returns values of type double. The function cbrtl both accepts and returns values of type long double. RETURN VALUES Functions in the standard math library libm.a, are referred to as -lm versions. Those in math library libmx.a are referred to as -lmx versions. Those in the the BSD math library libm43.a are referred to as -lm43 versions. The -lm and -lmx versions always return the default Quiet NaN and set errno to EDOM when a NaN is used as an argument. A NaN argument usually causes the -lm43 versions to return the same argument. The -lm43 versions never set errno. If x is negative, the sqrt functions return a quiet NaN. The -lm and -lm43 versions also set the flag in the floating-point coprocessor to indicate an invalid operation. The functions in the standard math library -lm and in library -lmx also set errno to EDOM. See matherr(3M) for a description of error handling for -lmx functions. NOTES Long double operations on this system are only supported in round-to- nearest rounding mode (the default). The system must be in round-to- nearest rounding mode when calling any of the long double functions, or incorrect answers result. Users concerned with portability to other computer systems should note that the long double and float versions of these functions are optional according to the ANSI C Programming Language Specification ISO/IEC 9899 : 1990 (E). Long double functions have been renamed to be compliant with the ANSI-C standard, however to be backward compatible, they may still be called with the double precision function name prefixed with a q. Code which calls sqrt() or sqrtf() will be compiled into the machine instruction sqrt.d or sqrt.s if the code uses #includes <math.h>. Errors cbrt is accurate to within 0.7 ULPs (a ULP if one Unit in Last Place). libm.a sqrt conforms to IEEE 754 and is correctly rounded in accordance with the rounding mode in force; the error is less than half a ULP in the default mode (round to nearest). The libfastm.a sqrt and fsqrt error is a maximum of one ULP. (See however, the comments regarding -lfastm above.) SEE ALSO math(3M) This man page is available only online.