|number||An expression that resolves to a positive number or numeric string.|
The SQRT function returns the square root of number. This numeric value can be expressed as either a number or as a string. Leading plus signs and leading and trailing zeros are ignored. A string is parsed as a number until a non-numeric character is encountered. Thus “7dwarves” is parsed as 7. Non-numeric strings and null strings are parsed as 0. The square root of 0 is 0.
You cannot return the square root of a negative number. Attempted to do so results in an <ILLEGAL VALUE> error.
The following example uses the SQRT function to calculate the square roots of the integers 0 through 16:
FOR x = 0 TO 16 PRINT "Square root of ":x:" = ":Sqrt(x) NEXT
The following example uses the SQRT function to calculate the square root of pi:
pi = 4 * ATAN(1) PRINT "Square root of pi = ":SQRT(pi)