##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::sqrt

From cppreference.com
< cpp‎ | numeric‎ | math

Defined in header `<cmath>` |  |
float sqrt( float arg ); | (1) |
double sqrt( double arg ); | (2) |
long double sqrt( long double arg ); | (3) |
double sqrt( Integral arg ); | (4) | (since C++11)

Computes the square root of `arg`.

### [edit] Parameters

arg | - | Value of a floating-point or Integral type

### [edit] Return value

Square root of `arg`.

Domain error occurs if `arg` is negative. NAN is returned in that case.

### [edit] See also

cbrt (C++11) | computes cubic root (3√x) (function) [edit]
pow | raises a number to the given power (xy) (function) [edit]
sqrt(std::complex) | complex square root in the range of the right half-plane (function template) [edit]
sqrt(std::valarray) | applies the function std::sqrt to each element of valarray (function template) [edit]
C documentation for sqrt

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/numeric/math/sqrt&oldid=67114"