Get Arctangent Method

The Get Arctangent method returns an approximate arctangent of the value that the number argument contains, expressed in radians and ranging from negative pi/2 through pi/2.

This method assumes the value that the number argument contains is the ratio of the following sides of a right triangle:

  • The side that is opposite of the angle that this method must calculate

  • The side that is adjacent to the angle

It returns a value for this ratio.

This method uses the same argument as the Get Absolute Value method. For more information, see Get Absolute Value Method.

Format

Math.atan(number)

The following example calculates the roof angles that are necessary for a house that includes the following dimensions:

  • An attic ceiling height of 8 feet at the roof peak

  • A 16 foot span from the outside wall to the center of the house

The Get Arctangent method returns the angle in radians. To convert the value to degrees, it multiplies it by 180/PI. To examine how the Get Arctangent method is different from the Get Arctangent 2 method, you can compare it to the example in the Get Arctangent 2 Method topic. These examples return the same value:

function RoofBtn_Click ()

{

   var height = 8;

   var span = 16;

   var angle = Math.atan(height/span)*(180/Math.PI);
   TheApplication().RaiseErrorText("The angle is " +

      Clib.rsprintf("%5.2f", angle) + " degrees.")

}