A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cplusplus.com/reference/cmath/sqrt/ below:

function

<cmath> <ctgmath>

sqrt
     double sqrt  (double x);      float sqrtf (float x);long double sqrtl (long double x);
     double sqrt (double x);      float sqrt (float x);long double sqrt (long double x);
     double sqrt (double x);      float sqrt (float x);long double sqrt (long double x);     double sqrt (T x);           // additional overloads for integral types

Compute square root

Returns the square root of x.

Header

<tgmath.h>

provides a type-generic macro version of this function.



Parameters
x
Value whose square root is computed.
If the argument is negative, a domain error occurs.

Return Value Square root of x.
If x is negative, a domain error occurs:

If a

domain error

occurs, the global variable

errno

is set to

EDOM

.



Example
1
2
3
4
5
6
7
8
9
10
11
12
/* sqrt example */
#include <stdio.h>      /* printf */
#include <math.h>       /* sqrt */

int main ()
{
  double param, result;
  param = 1024.0;
  result = sqrt (param);
  printf ("sqrt(%f) = %f\n", param, result );
  return 0;
}

Output:
sqrt(1024.000000) = 32.000000


See also
pow
Raise to power (function)
log
Compute natural logarithm (function)

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4