sincos

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

名前

sincos, sincosf, sincosl - 正弦と余弦を同時に計算する  

ライブラリ

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

書式

#define _GNU_SOURCE         /* feature_test_macros(7) 参照 */
#include <math.h>

void sincos(double x, double *sin, double *cos);
void sincosf(float x, float *sin, float *cos);
void sincosl(long double x, long double *sin, long double *cos);
 

説明

アプリケーションの中には、同じ角度 x について正弦と余弦の両方の計算が必要なものがある。 この関数は両者を同時に計算し、その結果を *sin と *cos に格納する。この関数を使うのは、 sin(3) と cos(3) の二つの関数を分けて呼び出すより効率的である。

x が NaN の場合、 *sin と *cos に NaN が返される。

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

返り値

これらの関数は void を返す。  

エラー

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

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

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

属性

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

標準規格

GNU.  

歴史

glibc 2.1.  

注意

To see the performance advantage of sincos(), it may be necessary to disable gcc(1) built-in optimizations, using flags such as:

cc -O -lm -fno-builtin prog.c
 

バグ

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

関連項目

cos(3), sin(3), tan(3)


 

Index

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

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