doubleからsingleのキャスト精度の向上方法?
Show older comments
添付画像みたいのキャスト処理をSimulinkモデルで実装してみましたが、 8.333333333333333(double)⇒8.3333330154419(single)になる理由は何でしょうか。 2進数⇔10進数の変換結果が約8.333333313465118になりますが、Simulink上でもこの結果ぐらいになり、浮動小数点のキャスト精度向上するために何か設定・コンフィギュレーションがありますでしょうか。(Matlab R2025Sp1)

Answers (1)
Takafumi
on 29 May 2018
浮動小数点の精度を確認するのに、epsコマンドがありまして、 single 型の精度は代替小数点7桁あたりまでです。
eps('single')
ans =
single
1.1920929e-07
1 Comment
nguyen congkien
on 30 May 2018
Edited: nguyen congkien
on 30 May 2018
Categories
Find more on Simulink in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!