Export (0) Print
Expand All
Expand Minimize

Converting VBScript's Cos Function


Windows PowerShell


Definition: Returns the cosine of an angle.

Cos

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:


0.52532198881773


Return to the VBScript to Windows PowerShell home page

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft