Keil Logo

sqrt

Summary
#include <math.h>

double sqrt (
  double x);  /* value to calculate square root of */
Description

The sqrt function calculates the square root of x.

Return Value

The sqrt function returns the positive square root of x.

  • If x < 0, sqrt returns NaN.
See Also

pow

Example
#include <math.h>
#include <stdio.h> /* for printf */

void tst_sqrt (void) {
  float x;
  float y;

  x = 25.0;
  y = sqrt (x); /* y = 5 */

  printf ("SQRT(%f) = %f\n", x, y);
}
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.