第七十八章 Caché 函数大全 $ZARCSIN 函数

224 阅读1分钟

第七十八章 Caché 函数大全 $ZARCSIN函数

反(弧)正弦函数。

参数

n 有符号的十进制数字。

描述

$ZARCSIN返回n的三角反正弦(弧)。结果以弧度表示。

参数

n

带符号的十进制数字,范围从1到-1(含)。可以将其指定为值,变量或表达式。超出范围的数字会产生<ILLEGAL VALUE>错误。非数字字符串的值为0。

以下是$ZARCSIN返回的反正弦值:

  • 1 返回 1.570796326794896619
  • 0 返回 0
  • -1 返回 -1.570796326794896619

示例

以下示例使可以比较数字的反正弦和反余弦:

/// d ##class(PHA.TEST.Function).ZARCSIN()
ClassMethod ZARCSIN()
{
   READ "Input a number: ",num
   IF num>1 { WRITE !,"ILLEGAL VALUE: number too big" }
   ELSEIF num<-1 { WRITE !,"ILLEGAL VALUE: number too small" }
   ELSE { 
         WRITE !,"the arc sine is: ",$ZARCSIN(num)
         WRITE !,"the arc cosine is: ",$ZARCCOS(num)
        }
   QUIT
}
DHC-APP>d ##class(PHA.TEST.Function).ZARCSIN()
Input a number: 1
the arc sine is: 1.570796326794896619
the arc cosine is: 0

以下示例比较了Caché分数数字($DECIMAL数字)和$DOUBLE数字的结果。在这两种情况下,正弦值0都正好为0:

/// d ##class(PHA.TEST.Function).ZARCSIN1()
ClassMethod ZARCSIN1()
{
	WRITE !,"the arc sine is: ",$ZARCSIN(0.0)
	WRITE !,"the arc sine is: ",$ZARCSIN($DOUBLE(0.0))
	WRITE !,"the arc sine is: ",$ZARCSIN(1.0)
	WRITE !,"the arc sine is: ",$ZARCSIN($DOUBLE(1.0))
	WRITE !,"the arc sine is: ",$ZARCSIN(-1.0)
	WRITE !,"the arc sine is: ",$ZARCSIN($DOUBLE(-1.0))
}

DHC-APP>d ##class(PHA.TEST.Function).ZARCSIN1()
 
the arc sine is: 0
the arc sine is: 0
the arc sine is: 1.570796326794896619
the arc sine is: 1.5707963267948965579
the arc sine is: -1.570796326794896619
the arc sine is: -1.5707963267948965579