Caché ObjectScript Reference
$ZARCSIN
[Home] [Back] [Next]
InterSystems: The power behind what matters   
Class Reference   
Search:    

Inverse (arc) sine function.
Synopsis
$ZARCSIN(n)
Parameter
n A signed decimal number.
Description
$ZARCSIN returns the trigonometric inverse (arc) sine of n. The result is given in radians.
Parameter
n
Signed decimal number ranging from 1 to -1 (inclusive). It can be specified as a value, a variable, or an expression. Numbers outside the range generate an <ILLEGAL VALUE> error. A non-numeric string is evaluated as 0.
The following are arc sine values returned by $ZARCSIN:
1 returns 1.570796326794896619
0 returns 0
-1 returns -1.570796326794896619
Examples
The following example permits you to compare the arc sine and the arc cosine of a number:
   READ "Input a number: ",num
   IF num>1 { WRITE !,"ILLEGAL VALUE: number too big" }
   ELSEIF num<-1 { WRITE !,"ILLEGAL VALUE: number too small" }
   ELSE { 
         WRITE !,"the arc sine is: ",$ZARCSIN(num)
         WRITE !,"the arc cosine is: ",$ZARCCOS(num)
        }
   QUIT
The following example compares the results from Caché fractional numbers ($DECIMAL numbers) and $DOUBLE numbers. In both cases, the arc sine of 0 is exactly 0:
  WRITE !,"the arc sine is: ",$ZARCSIN(0.0)
  WRITE !,"the arc sine is: ",$ZARCSIN($DOUBLE(0.0))
  WRITE !,"the arc sine is: ",$ZARCSIN(1.0)
  WRITE !,"the arc sine is: ",$ZARCSIN($DOUBLE(1.0))
  WRITE !,"the arc sine is: ",$ZARCSIN(-1.0)
  WRITE !,"the arc sine is: ",$ZARCSIN($DOUBLE(-1.0))
 
See Also