PowerTip: Find Tangent of 45-Degree Angle with PowerShell


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)

Comments (4)

  1. Jv says:

    But..but..but… They are all zero!


    PS C:scripts> [math]::tanh(0)
    0
    PS C:scripts> [math]::tanh(30)
    1
    PS C:scripts> [math]::tanh(60)
    1
    PS C:scripts> [math]::tanh(90)
    1
    PS C:scripts> [math]::tanh(120)
    1
    PS C:scripts>

  2. PetSerAl says:

    [Math]::Tan works with radians not degrees.

    [Math]::Tan(45*[Math]::PI/180)

    2 Jv
    Tan and Tanh is different things.

  3. Sudeep says:

    Pretty gud..

  4. ed wilson says:

    @PetSerAl you are right. Should have looked this up first, it is documented on MSDN:
    https://msdn.microsoft.com/en-us/library/system.math.tan(v=vs.110).aspx

Skip to main content