User Tools

Site Tools


ugbasic:user:kw:sqr
Translations of this page:


ugBASIC User Manual

SQR ✓

SYNTAX

   = SQR(expression)

PURPOSE

The SQR command (short for “square root”) is a mathematical function that is used to calculate the square root of a number. In other words, given a number x, the command SQR(x) returns the number that, when multiplied by itself, gives the result x.

The SQR command has many applications in programming: it is used in any calculation that requires the calculation of the square root, such as in the Pythagorean theorem. The square root is present in many physics formulas, such as in the calculation of velocity. It is used also to calculate the lengths of segments or areas of geometric figures, and in many statistical calculations, such as in the calculation of standard deviation.

The square root of a negative number is not defined in real numbers. If you try to calculate the square root of a negative number, the result is indefinite. Moreover, the function is defined in the integer numbers domain.

EXAMPLE

  PRINT SNG(81)

See also the following example files:

AVAILABLE ON

ANY PROBLEM?

If you have encountered a problem using this command, if you think there is a bug or the explanation is unclear, please open an issue for this keyword on GitHub. Thank you!

POWERED BY