< Perl Programming < Keywords

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
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.