Error Messages/40061

Warning message

 Square root of a negative number.


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.


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

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


You are not allowed to post comments.