C-standard-library-c-function-acos

提供:Dev Guides
移動先:案内検索

Cライブラリ関数-acos()

説明

Cライブラリ関数* double acos(double x)は、ラジアン単位の *x のアークコサインを返します。

宣言

次に、acos()関数の宣言を示します。

double acos(double x)

パラメーター

  • x -これは区間[-1、+ 1]の浮動小数点値です。

戻り値

この関数は、間隔[0、pi]ラジアンでxの主アークコサインを返します。

次の例は、acos()関数の使用法を示しています。

#include <stdio.h>
#include <math.h>

#define PI 3.14159265

int main () {
   double x, ret, val;

   x = 0.9;
   val = 180.0/PI;

   ret = acos(x) * val;
   printf("The arc cosine of %lf is %lf degrees", x, ret);

   return(0);
}

次の結果を生成する上記のプログラムをコンパイルして実行しましょう-

The arc cosine of 0.900000 is 25.855040 degrees