docs.intersystems.com
Home / ObjectScript Reference / ObjectScript Functions / $ZCOT


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


Cotangent function.
Synopsis
$ZCOT(n)
Parameter
n An angle in radians.
Description
$ZCOT returns the trigonometric cotangent of n. The result is a signed decimal number.
Parameter
n
An angle in radians, specified as a nonzero value. It can be specified as a value, a variable, or an expression. A value of 0 generates an <ILLEGAL VALUE> error. A non-numeric string is evaluated as 0.
Examples
The following example permits you to compute the cotangent of a number:
   READ "Input a number: ",num
   IF num=0 { WRITE !,"zero is an illegal value" }
   ELSE { 
         WRITE !,"the cotangent is: ",$ZCOT(num)
        }
   QUIT
The following example compares the results from InterSystems IRIS fractional numbers ($DECIMAL numbers) and $DOUBLE numbers:
  WRITE !,"the cotangent is: ",$ZCOT(1.0)
  WRITE !,"the cotangent is: ",$ZCOT($DOUBLE(1.0))
  WRITE !,"the cotangent is: ",$ZCOT(-1.0)
  WRITE !,"the cotangent is: ",$ZCOT($DOUBLE(-1.0))
  WRITE !,"the cotangent is: ",$ZCOT($ZPI/2)
  WRITE !,"the cotangent is: ",$ZCOT($DOUBLE($ZPI)/2)
Note that the cotangent of pi/2 is a fractional number, not 0.
See Also


Previous section           Next section
View this book as PDF
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA
Content Date/Time: 2019-02-14 22:44:32