Siebel eScript Language Reference > Siebel eScript Commands > The Math Object >

Math.atan2() Method


This function returns an implementation-dependent approximation to the arctangent of the quotient of its arguments.

Syntax

Math.atan2(y, x)

Parameter
Description
y
The value on the y axis
x
The value on the x axis

Returns

An implementation-dependent approximation of the arctangent of y/x, in radians.

Usage

This function returns an implementation-dependent approximation to the arctangent of the quotient, y/x, of the arguments y and x, where the signs of the arguments are used to determine the quadrant of the result. It is intentional and traditional for the two-argument arctangent function that the argument named y be first and the argument named x be second. The return value is expressed in radians and ranges from -pi to +pi.

Example

This example finds the roof angle necessary for a house with an attic ceiling of 8 feet (at the roof peak) and a 16-foot span from the outside wall to the center of the house. The Math.atan2() function returns the angle in radians; it is multiplied by 180/PI to convert it to degrees. Compare the example in the discussion of Math.atan() Method to understand how the two arctangent functions differ. Both examples return the same value.

function RoofBtn2_Click ()
{
   var height = 8;
   var span = 16;
   var angle = Math.atan2(span, height)*(180/Math.PI);

   TheApplication().RaiseErrorText("The angle is " +
   Clib.rsprintf("%5.2f", angle) + " degrees.")
}

See Also

Math.acos() Method, Math.asin() Method, Math.atan() Method, Math.cos() Method, Math.sin() Method, and Math.tan() Method


 Siebel eScript Language Reference 
 Published: 18 April 2003