Perl Programming/Keywords/sqrt

From Wikibooks, open books for an open world
Jump to navigation Jump to search
Previous: sprintf Keywords Next: srand

The sqrt keyword[edit | edit source]

sqrt returns the positive square root of EXPRESSION. If EXPRESSION is omitted, $_ is used instead. Works for non-negative operands, if the Math::Complex module has not be loaded.

Syntax[edit | edit source]

  sqrt EXPRESSION

Examples[edit | edit source]

print sqrt(1) . "\n";
print sqrt(2) . "\n";
1
1.4142135623731


Previous: sprintf Keywords Next: srand