トップページ > キーワード検索 > atan2()
C言語規格
C言語(その他)
プログラム
その他
atan2()
機能 逆正接(アークタンジェント)を計算することを表す。

2つの引数が 0 の場合は定義域エラー(EDOM)が発生することがある。
定義 #include <math.h>

double atan2 ( double y, double x );
float atan2 ( float y, float x );
long double atan2 ( long double y, long double x );

※C99規格では以下の定義となる
double atan2 ( double y, double x );
float atan2f ( float y, float x );
long double atan2l ( long double y, long double x );
引数
xy座標の値
yx座標の値
戻り値 計算結果を返す。
実装例
#include <math.h>
#include <stdio.h>

int main(void)
{
    double a = 1.0;
    double b = 1.0;
    
    printf("atan2(%f,%f) = %f\n", a, b, atan2(a,b) );

    return 0;
}
実行結果
atan2(1.000000,1.000000) = 0.785398





inserted by FC2 system