Skip to main content

$ZARCTAN (ObjectScript)

Returns the inverse (arc) tangent of the given argument.

Synopsis

$ZARCTAN(n)

Argument

Argument Description
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.

Argument

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. For evaluation of mixed numeric strings and non-numeric strings, refer to Strings As Numbers.

The following are arc tangent values returned by $ZARCTAN:

n Returned Arc Tangent
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 InterSystems IRIS 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

FeedbackOpens in a new tab