How I can multiply 2 variables without losing precision
조회 수: 7 (최근 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!