InterSystems IRIS Data Platform 2019.2  /  ObjectScript Reference

ObjectScript Reference
Previous section           Next section
InterSystems: The power behind what matters   

Inverse (arc) cosine function.
n A signed decimal number.
$ZARCCOS returns the trigonometric inverse (arc) cosine of n. The result is given in radians (to 18 decimal places).
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 cosine values returned by $ZARCCOS:
1 returns 0
0 returns 1.570796326794896619
-1 returns pi (3.141592653589793238)
The following example permits you to compare the arc cosine and the arc sine 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 cosine is: ",$ZARCCOS(num)
         WRITE !,"the arc sine is: ",$ZARCSIN(num)
The following example compares the results from InterSystems IRIS fractional numbers ($DECIMAL numbers) and $DOUBLE numbers. In both cases, the arc cosine of 1 is exactly 0:
  WRITE !,"the arc cosine is: ",$ZARCCOS(0.0)
  WRITE !,"the arc cosine is: ",$ZARCCOS($DOUBLE(0.0))
  WRITE !,"the arc cosine is: ",$ZARCCOS(1.0)
  WRITE !,"the arc cosine is: ",$ZARCCOS($DOUBLE(1.0))
  WRITE !,"the arc cosine is: ",$ZARCCOS(-1.0)
  WRITE !,"the arc cosine is: ",$ZARCCOS($DOUBLE(-1.0))
See Also

Previous section           Next section
Send us comments on this page
View this book as PDF   |  Download all PDFs
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA
Content Date/Time: 2019-08-23 06:48:00