$ZSEC (ObjectScript)
Synopsis
$ZSEC(n)
Argument
Argument | Description |
---|---|
n | Angle in radians ranging from 0 to 2 Pi. It can be specified as a value, a variable, or an expression. |
Description
$ZSEC returns the trigonometric secant of n. The result is a signed decimal number. The secant of 0 is 1. The secant of pi is -1.
InterSystems IRIS uses the host operating system’s routines to calculate trigonometric functions. For this reason, results obtained from different operating systems may not precisely match.
Argument
n
An angle in radians ranging from Pi to 2 Pi (inclusive). It can be specified as a value, a variable, or an expression. You can specify the value Pi by using the $ZPI special variable. You can specify positive or negative values smaller than Pi or larger than 2 Pi; InterSystems IRIS resolve these values to the corresponding multiple of Pi. For example, 3 Pi is equivalent to Pi, and negative Pi is equivalent to Pi.
A non-numeric string is evaluated as 0 and therefore $ZSEC returns 1. For evaluation of mixed numeric strings and non-numeric strings, refer to Strings As Numbers.
Example
The following example permits you to compute the secant of a number:
READ "Input a number: ",num
IF $ZABS(num)>(2*$ZPI) { WRITE !,"number is a larger than 2 pi" }
ELSE {
WRITE !,"the secant is: ",$ZSEC(num)
}
QUIT