How I can multiply 2 variables without losing precision
4 ビュー (過去 30 日間)
古いコメントを表示
a= 378979003;
b= 1.443e-5;
The result of a*b is 5468.7 but I'm very interested in higher precision (such as 5468.6670). How to achieve those precision?
1 件のコメント
John D'Errico
2014 年 7 月 4 日
The point of both answers is that MATLAB never did "lose" any precision. You did not see those extra digits because of the wrong format for your goals.
採用された回答
Azzi Abdelmalek
2014 年 7 月 4 日
You can check that a*b and 5468.7 are not equal
a*b==5468.7
Now try this
format long
c=a*b
0 件のコメント
その他の回答 (1 件)
Ben11
2014 年 7 月 4 日
Try this:
a= 378979003;
b= 1.443e-5;
format long
a*b
ans =
5.468667013290000e+03
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!