TechNet
Export (0) Print
Expand All
Collapse the table of content
Expand the table of content
Expand Minimize

Converting VBScript's Tan Function


Windows PowerShell


Definition: Returns the tangent of an angle.

Tan

Good point: Windows PowerShell wouldn’t be much of a scripting language if it allowed you to calculate arctangents but didn't allow you to calculate tangents. Fortunately, that's not the case: you can determine the tangent of an angle by using the System.Math class and calling the Tan method. Here’s a command that calculates the tangent of a 45-degree angle and then stores that value in the variable $a:


$a = [math]::tan(45)

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


1.61977519054386


Return to the VBScript to Windows PowerShell home page

Show:
© 2016 Microsoft