# Error Messages/40061

## Warning message

Warning: Square root of a negative number.

## Cause

This warning is issued when the Show Result Warnings preference is on and an attempt is made to take a square root of a negative number. If the warning is ignored, the result will be NaN.

When taking the square root of an array, Sqrt(A), the warning may display if any value in the array is negative.

## Remedy

There are two methods for avoiding this warning without turning Show Result Warnings globally. These are demonstrated here.

`If A >= 0 Then Sqrt(A) Else Null`

`IgnoreWarnings(Sqrt(A))`

The first instance is convenient and readable when you have a particular substitution value in mind. The second method evaluates faster.

If you really do want to take the Sqrt of a negative number, and obtain a complex number, then use the CSqrt function in the Complex Number Library.

## See Also

Comments

Enable comment auto-refresher