sqrt
square root function
You're viewing an older version of this page (#3330). View the current version.
NAME
sqrt
INTERFACE
#include <math.h>
double sqrt ( double x ) long sqrtl ( long double x ) float sqrtf ( float x )
DESCRIPTION
The sqrt function compute the non-negative square root of x.
Example 1
#include <math.h>
#include <stdio.h>
int main(void)
{
printf("Square root of 16.0 is %f", sqrt(16.0));
}output
Square root of 16.0 is 4.000000SPECIAL VALUES
sqrt ( -0 ) returns -0.
sqrt ( x ) returns a NaN and generates a domain error for x < 0.
STANDARDS
The sqrt function conforms to ISO/IEC 9899:1999(E).