Converting VBScript's Cos Function
Definition: Returns the cosine of an angle.
Yes, we know: in a million years you'll never once have to calculate the cosine of an angle in one of your scripts. Still, better safe than sorry, right? In Windows PowerShell you can determine the cosine of an angle using the System.Math class and the Cos method. This sample command returns the cosine of a 45-degree angle and then stores the value in a variable named $a:
$a = [math]::cos(45)
When you run this command and then echo back the value of $a you should get the following: