Skip to main content
Previous section   Next section

$ZSEC

Returns the trigonometric secant of the specified angle value.

Synopsis

$ZSEC(n)

Parameter

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.

Note:

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.

Parameter

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; 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.

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
Copy code to clipboard

See Also