HTBasic Help
×
Menu
Index

SQRT

Returns the square root of an expression.
 
 SQRT( numeric-expression )
SQR( numeric-expression )
 
Usage:
Root=SQRT(10*X)
PRINT "Square Root of";Y;"=";SQR(Y)
Example: SQRT.BAS
Description:
The square root function may be entered as either SQRT or SQR.
COMPLEX Arguments
SQRT accepts either a COMPLEX or REAL argument and returns a value of the same type. SQRT(Z) returns the principal value, defined (in real arithmetic) as:
REAL(SQRT(Z)) = SQRT((SQRT(REAL(Z)^2+IMAG(Z)^2)+REAL(Z))/2)
 
IMAG(SQRT(Z)) = SGN(Y)*
 SQRT((SQRT(REAL(Z)^2+IMAG(Z)^2)-REAL(Z))/2)
which returns a real part = 0. The domain of SQRT includes all points in the complex plane. However, intermediate values generated during the calculation of the function can also cause over or underflow errors for very large or small values of Z.
See Also: