Skip to main content

This is documentation for Caché & Ensemble. See the InterSystems IRIS version of this content.Opens in a new tab

For information on migrating to InterSystems IRISOpens in a new tab, see Why Migrate to InterSystems IRIS?

$ZARCCOS

逆 (アーク) コサイン関数です。

Synopsis

$ZARCCOS(n)

パラメータ

n 符号付き 10 進数

概要

$ZARCCOS は、n の三角関数の逆 (アーク) コサインを返します。結果は、ラジアンで返されます (小数点第 18 位まで)。

パラメータ

n

1 から -1 までの範囲の符号付き 10 進数です。値、変数、式として指定することができます。範囲外の数値では、<ILLEGAL VALUE> エラーが発生します。非数値文字列は 0 として評価されます。

以下は、$ZARCCOS によって返されるアーク・コサイン値です。

1 これは、0 を返します。
0 これは、1.570796326794896619 を返します。
-1 これは、pi (3.141592653589793238) を返します。

以下の例では、数のアーク・コサインとアーク・サインの比較を行います。

   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 cosine is: ",$ZARCCOS(num)
         WRITE !,"the arc sine is: ",$ZARCSIN(num)
        }
   QUIT

以下の例は、Caché 小数 ($DECIMAL の数値) の結果と $DOUBLE の数値の結果を比較します。どちらの場合も、1 のアーク・コサインは正確に 0 になります。

  WRITE !,"the arc cosine is: ",$ZARCCOS(0.0)
  WRITE !,"the arc cosine is: ",$ZARCCOS($DOUBLE(0.0))
  WRITE !,"the arc cosine is: ",$ZARCCOS(1.0)
  WRITE !,"the arc cosine is: ",$ZARCCOS($DOUBLE(1.0))
  WRITE !,"the arc cosine is: ",$ZARCCOS(-1.0)
  WRITE !,"the arc cosine is: ",$ZARCCOS($DOUBLE(-1.0))

関連項目

FeedbackOpens in a new tab