Why R2018a and 2019b give different results for cosine (cosd) function?

2 ビュー (過去 30 日間)
Kevin Krüger
Kevin Krüger 2020 年 4 月 14 日
回答済み: Steven Lord 2020 年 4 月 14 日
Hello,
given the following code
a = single(-91.5380859);
b = cosd(a);
c = double(b)
I got different results for c depending on the matlab version I use.
2018a: -0.026841441169381
2019b: -0.026841439306736
I figured out that the binary representation for b is different in the last bit:
2018a: 10111100110110111110001010010101
2019b: 10111100110110111110001010010100
So assume that the funtion cosd is rounding in different ways. But why?
Thanks.

採用された回答

Steven Lord
Steven Lord 2020 年 4 月 14 日
I suspect the answer was changed by the fix for bug 1839169.

その他の回答 (0 件)

製品


リリース

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by