Perl Programming/Keywords/sqrt

Previous: sprintf Keywords Next: srand

The sqrt keyword

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

  sqrt EXPRESSION

Examples

print sqrt(1) . "\n";
print sqrt(2) . "\n";
1
1.4142135623731
Previous: sprintf Keywords Next: srand
Category:Book:Perl Programming#Keywords/sqrt%20
Category:Book:Perl Programming