Retro Rocket OS
BASIC-Powered Operating System
Loading...
Searching...
No Matches
SQR Function
SQR(real-expression)

Returns the square root of the given expression.


Examples

PRINT SQR(9)

Produces 3.

PRINT SQR(2)

Produces approximately 1.414213.

REM Validate identity: SQR(x^2) = ABS(x)
x# = -7
PRINT "SQR("; x#; "^2) = "; SQR(x# * x#)
PRINT "ABS("; x#; ") = "; ABS(x#)

Notes

  • Argument must be a non-negative real number.
  • Passing a negative value results in an error.
  • Return value is a real number.
  • For arbitrary powers (including fractional), use POW.

See also: POW · EXP · ABS