Converting VBScript's Log Function

Definition: Returns the natural logarithm of a number.


Most people probably have the natural logarithms for all known numbers committed to memory. If you don't, and you need to know the log for a particular number, then use the System.Math class and the Log method. This command returns the log of 100 and assigns the value to the variable $a:

$a = [math]::log(100)

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


Return to the VBScript to Windows PowerShell home page