How would I make my for loop more accurate.
1 回表示 (過去 30 日間)
古いコメントを表示
a = 0;
b = 1;
c = 0;
d = 1;
for k = 1:700
c = a + b;
a = b;
b = c;
d = [d c];
end
format long
d(700) %>>> 8.747081495575278e+145
fibonacci(700) %>>> 8.747081495575285e+145
I believe the function fibonacci(n) has the correct number.
How does the function fibonacci have a more accurate number?
0 件のコメント
回答 (1 件)
Walter Roberson
2019 年 2 月 10 日
fibonnaci() is a function in the Symbolic Toolbox. It calculates the numbers as indefinite precision software integers, and then converts the result to double.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Operators and Elementary Operations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!