cos

Section: C Library Functions (3)
Updated: 2026-02-08
Index JM Home Page roff page
 

名前

cos, cosf, cosl - 余弦 (コサイン) 関数  

ライブラリ

数学ライブラリ (libm,~-lm)  

書式

#include <math.h>

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

glibc 向けの機能検査マクロの要件 (feature_test_macros(7) 参照):

cosf(), cosl():

    _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
        || /* Since glibc 2.19: */ _DEFAULT_SOURCE
        || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
 

説明

これらの関数は x の余弦 (コサイン) の値を返す。 x はラジアン単位で指定する。  

返り値

成功すると、これらの関数は x の余弦を返す。

x が NaN の場合、NaN が返される。

x が正の無限大か負の無限大の場合、 領域エラー (domain error) が発生し、NaN が返される。  

エラー

これらの関数を呼び出した際にエラーが発生したかの判定方法についての情報は math_error(7) を参照のこと。

以下のエラーが発生する可能性がある。

Domain error: x is an infinity
errno に EDOM が設定される (「バグ」の節も参照)。 不正 (invalid) 浮動小数点例外 (FE_INVALID) が上がる。
 

属性

この節で使用されている用語の説明については、 attributes(7) を参照。
インターフェース属性値
cos(), cosf(), cosl() Thread safetyMT-Safe
 

標準規格

C11, POSIX.1-2008.  

歴史

C89, POSIX.1-2001.

double 版の関数は SVr4, 4.3BSD にも準拠している。  

バグ

Before glibc 2.10, the glibc implementation did not set errno to EDOM when a domain error occurred.  

関連項目

acos(3), asin(3), atan(3), atan2(3), ccos(3), sin(3), sincos(3), tan(3)


 

Index

名前
ライブラリ
書式
説明
返り値
エラー
属性
標準規格
歴史
バグ
関連項目

This document was created by man2html, using the manual pages.