READ "Input a number: ",num
IF $ZABS(num)>(2*$ZPI) { WRITE !,"number is a larger than 2 pi" }
ELSE {
WRITE !,"the cosine is: ",$ZCOS(num)
}
QUIT
The following example compares the results from InterSystems IRIS fractional numbers ($DECIMAL numbers) and $DOUBLE numbers. In both cases, the cosine of 0 is exactly 1, the cosine of pi is exactly -1:
WRITE !,"the cosine is: ",$ZCOS(0.0)
WRITE !,"the cosine is: ",$ZCOS($DOUBLE(0.0))
WRITE !,"the cosine is: ",$ZCOS(1.0)
WRITE !,"the cosine is: ",$ZCOS($DOUBLE(1.0))
WRITE !,"the cosine is: ",$ZCOS($ZPI)
WRITE !,"the cosine is: ",$ZCOS($DOUBLE($ZPI))