[過去ログ] Qiita 3 - キータぞ、来たぞ、キータだぞー (1002レス)
上下前次1-新
抽出解除 必死チェッカー(本家) (べ) 自ID レス栞 あぼーん
このスレッドは過去ログ倉庫に格納されています。
次スレ検索 歴削→次スレ 栞削→次スレ 過去ログメニュー
702(2): デフォルトの名無しさん [sage] 2023/12/10(日) 00:04:11.75 ID:zoYXXcKe(1/2) AAS
>>699699(1): デフォルトの名無しさん [] 2023/12/09(土) 19:58:58.90 ID:DXmw58tM(4/4) AAS
> 各種言語のライブラリを作ってるのはたいていラジアン派だがお前のようなアホは一人もいないぞ
このひとBoostとか.NET Frameworkとか知らないんだろうな。
#include <iostream>
#include <boost/math/special_functions/sin_pi.hpp>
#include <boost/math/special_functions/cos_pi.hpp>
int main()
{
for (int i = 0; i <= 8; i++) {
double s = boost::math::sin_pi(i / 4.0);
double c = boost::math::cos_pi(i / 4.0);
printf("sin(%d/4π) = %19.16f cos(%d/4π) = %19.16f\n", i, s, i, c);
}
}
sin(0/4π) = 0.0000000000000000 cos(0/4π) = 1.0000000000000000
sin(1/4π) = 0.7071067811865476 cos(1/4π) = 0.7071067811865476
sin(2/4π) = 1.0000000000000000 cos(2/4π) = 0.0000000000000000
sin(3/4π) = 0.7071067811865476 cos(3/4π) = -0.7071067811865476
sin(4/4π) = -0.0000000000000000 cos(4/4π) = -1.0000000000000000
sin(5/4π) = -0.7071067811865476 cos(5/4π) = -0.7071067811865476
sin(6/4π) = -1.0000000000000000 cos(6/4π) = 0.0000000000000000
sin(7/4π) = -0.7071067811865476 cos(7/4π) = 0.7071067811865476
sin(8/4π) = 0.0000000000000000 cos(8/4π) = 1.0000000000000000
外部リンク:wandbox.org
こうなった
#include <iostream>
#include <boost/math/special_functions/sin_pi.hpp>
#include <boost/math/special_functions/cos_pi.hpp>
int main()
{
for (int i = 0; i <= 12; i++) {
double s = boost::math::sin_pi(i / 6.0);
double c = boost::math::cos_pi(i / 6.0);
printf("sin(%d/6π) = %19.16f cos(%d/6π) = %19.16f\n", i, s, i, c);
}
}
sin(0/6π) = 0.0000000000000000 cos(0/6π) = 1.0000000000000000
sin(1/6π) = 0.5000000000000000 cos(1/6π) = 0.8660254037844387
sin(2/6π) = 0.8660254037844386 cos(2/6π) = 0.5000000000000000
sin(3/6π) = 1.0000000000000000 cos(3/6π) = 0.0000000000000000
sin(4/6π) = 0.8660254037844387 cos(4/6π) = -0.4999999999999999
sin(5/6π) = 0.4999999999999999 cos(5/6π) = -0.8660254037844387
sin(6/6π) = -0.0000000000000000 cos(6/6π) = -1.0000000000000000
sin(7/6π) = -0.5000000000000002 cos(7/6π) = -0.8660254037844385
sin(8/6π) = -0.8660254037844385 cos(8/6π) = -0.5000000000000002
sin(9/6π) = -1.0000000000000000 cos(9/6π) = 0.0000000000000000
sin(10/6π) = -0.8660254037844385 cos(10/6π) = 0.5000000000000002
sin(11/6π) = -0.5000000000000002 cos(11/6π) = 0.8660254037844385
sin(12/6π) = 0.0000000000000000 cos(12/6π) = 1.0000000000000000
704: 702 [sage] 2023/12/10(日) 02:04:39.98 ID:zoYXXcKe(2/2) AAS
>>703703(1): デフォルトの名無しさん [sage] 2023/12/10(日) 01:52:17.90 ID:K18bkLWA(1) AAS
1/6はdoubleで正確に表せられないからそれやりたかったら分数型か度数法採用した三角関数使えって説明されないとわからん人かな
分かってるよ
元の話 >>621-623に対応するのは1/6だからやってみただけ
上下前次1-新書関写板覧索設栞歴
スレ情報 赤レス抽出 画像レス抽出 歴の未読スレ AAサムネイル
ぬこの手 ぬこTOP 0.039s