トップページ > キーワード検索 > cos()
C言語規格
C言語(その他)
プログラム
その他
cos()
機能 余弦(コサイン)を計算することを表す。
定義 #include <math.h>

double cos ( double x );
float cos ( float x );
long double cos ( long double x );

※C99規格では以下の定義となる
double cos ( double x );
float cosf ( float x );
long double cosl ( long double x );
引数
x角度(ラジアン値)
戻り値 計算結果を返す。
実装例
#include <math.h>
#include <stdio.h>

int main(void)
{
    double a = 3.1415926;
    
    printf("cos(%f) = %f\n", a, cos(a) );  /* cos(π) */

    return 0;
}
実行結果
cos(3.141593) = -1.000000





inserted by FC2 system