$ZARCSIN (ObjectScript)
Returns the inverse (arc) sine of the given argument.
Synopsis
$ZARCSIN(n)
Argument
Argument | Description |
---|---|
n | A signed decimal number. |
Description
$ZARCSIN returns the trigonometric inverse (arc) sine of n. The result is given in radians.
Argument
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. For evaluation of mixed numeric strings and non-numeric strings, refer to Strings As Numbers.
The following are arc sine values returned by $ZARCSIN:
n | Returned Arc Sine |
---|---|
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 InterSystems IRIS 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))