July 19th, 2015

PowerTip: Find Tangent of 45-Degree Angle with PowerShell

Doctor Scripto
Scripter

Summary: Find the tangent of a 45-degree angle with Windows PowerShell.

Hey, Scripting Guy! Question How can I use Windows PowerShell to obtain the tangent of a 45-degree angle?

Hey, Scripting Guy! Answer Use the Tan static method from the [math] class, for example:

[math]::tan(45)

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

1 comment

Discussion is closed. Login to edit/delete existing comments.

Newest
Newest
Popular
Oldest
  • Евгений Лыков

    from the official .NET documentation:

    Math.Tan(Double) Method
    public static double Tan (double a);
    where a Double: An angle, measured in radians.

    to convert degrees to radians, and vice versa (in Powershell):
    $rad = $deg * ([Math]::PI/180)
    $deg = $rad * (180/[Math]::PI)

Feedback