sqrt

sqrt(x)

Try it yourself:

See also:

sqrt(): Square Root

sqrt() returns the principal square root. For nonnegative real x, sqrt(x) is the nonnegative value whose square is x. It is used in distance, standard deviation, and geometry.

Domain and checks

Negative real inputs have no real square root; use complex arithmetic only when appropriate. Verify a result with square(). Use hypot() for stable two-dimensional lengths and pow() for a general exponent.

Square roots preserve units only when those units have a meaningful square-root form. Near zero, avoid subtracting nearly equal squared quantities before calling sqrt.

All functions