sqrt()

Compute square root.

  #include <math.h>
  
  double sqrt(double x);
  
  float sqrtf(float x);
  
  long double sqrtl(long double x);    
Parameter

x

A floating point value

Remarks

These functions return the square root of x. These functions assign EDOM to errno if x < 0. Use fpclassify() to check the validity of the results returned by these functions.

This facility may not be available on configurations of the EWL that run on platforms that do not have floating-point math capabilities.

Listing: Example of sqrt() usage

#include <math.h>

#include <stdio.h>

int main(void)

{

double x = 64.0;

printf("The square root of %f is %f.\n", x, sqrt(x));

return 0;

}

Output:

The square root of 64.000000 is 8.000000.