Converting VBScript's Sqr Function

Definition: Returns the square root of a number.

Sqr

Finally, a mathematical construct we all recognize! Granted, you probably need to calculate square roots about as often as you need to calculate arctangents. (On the other hand, and unlike arctangents, at least most of us know what square roots are.) Best of all, even if you don't know what square roots are you can still calculate them by using the System.Math class and the Sqrt method. For example, this command determines the square root of 144 and stores the result in the variable $a:

$a = [math]::sqrt(144)

When you run this command and then echo back the value of $a you should get the following:

12

Return to the VBScript to Windows PowerShell home page