Caché ObjectScript Reference
$ZARCTAN
[Back] [Next]
   
Server:docs1
Instance:LATEST
User:UnknownUser
 
-
Go to:
Search:    

Inverse (arc) tangent function.
Synopsis
$ZARCTAN(n)
Parameter
n Any positive or negative number.
Description
$ZARCTAN returns the trigonometric inverse (arc) tangent of n. Possible results range from 1.57079 (half of pi) through zero to –1.57079. The result is given in radians.
Parameter
n
Any positive or negative number. It can be specified as a value, a variable, or an expression. You can use the $ZPI special variable to specify pi. A non-numeric string is evaluated as 0.
The following are arc tangent values returned by $ZARCTAN:
2 returns 1.107148717794090502
1 returns .7853981633974483098
0 returns 0
-1 returns -.7853981633974483098
Examples
The following example permits you to calculate the arc tangent of a number:
   READ "Input a number: ",num
   WRITE !,"the arc tangent is: ",$ZARCTAN(num)
   QUIT
The following example compares the results from Caché fractional numbers ($DECIMAL numbers) and $DOUBLE numbers. In both cases, the arc tangent of pi/2 is a fractional number (not 1), but the arc tangent of 0 is 0:
  WRITE !,"the arc tangent is: ",$ZARCTAN(0.0)
  WRITE !,"the arc tangent is: ",$ZARCTAN($DOUBLE(0.0))
  WRITE !,"the arc tangent is: ",$ZARCTAN($ZPI)
  WRITE !,"the arc tangent is: ",$ZARCTAN($DOUBLE($ZPI))
  WRITE !,"the arc tangent is: ",$ZARCTAN($ZPI/2)
  WRITE !,"the arc tangent is: ",$ZARCTAN($DOUBLE($ZPI)/2)
 
See Also