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

Returns the trigonometric secant of the specified angle value.
n Angle in radians ranging from 0 to 2 Pi. It can be specified as a value, a variable, or an expression.
$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.
Caché uses the host operating system’s routines to calculate trigonometric functions. For this reason, results obtained from different operating systems may not precisely match.
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; Caché 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.
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)
See Also