Numerical errors of basic multiple
14 次查看(过去 30 天)
显示 更早的评论
When using matlab multiple calculation, some errors happen
a = 7*13e-6;
b = 6*13e-6;
the answer is
a = 9.09999999999999999e-5
b = 7.80000000000000000e-5
erroe happened at a but not at b;
So how this error happen and how * works? On what condition the error happen?
2 个评论
KALYAN ACHARJYA
2019-8-26
Error?
>> a =13e-6
a =
1.300000000000000e-05
>> 7*a
ans =
9.099999999999999e-05
采纳的回答
Ted Shultz
2019-8-26
These are floating point calculations. Not every number can be represented, and this rounding error can compound when you do math with these imperfect numbers.
"Floating-point error arises because real numbers cannot, in general, be accurately represented in a fixed space."
1 个评论
Ted Shultz
2019-8-26
Here is a thread, with links to other threads that address this in more detail:
更多回答(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!