Sqr

In Visual Basic, the Sqr function is used to find the square root of a function. The result of a Sqr function is of data type double. The syntax is:
Sqr(number)
where number is a positive number or a variable ,constant, or even another function representing a positive number.

(BASIC:)

The SQR function computes the square root of its argument. This is -- as usual in computing -- the nonnegative branch. So for any x>=0,

SQR(x*x)=ABS(x)
(to use BASIC syntax).

If x<0, SQR(x) will cause a run time error.

(Pascal:)

Perversely, Pascal defines sqr(x) to compute the square of x. So

SQR(x)=x*x
for any x.

This gave many computer children of the 80s great pain when trying to continue to program in both BASIC and Pascal.

Log in or register to write something here or to contact authors.