The result of 0.3+0.15==0.45 is true or false?

5 次查看(过去 30 天)
Hi, I have a problem. I ran this expression "0.3+0.15==0.45" in Matlab the result is "0", but I ran the same expression in Mathematica, the result is "True". Why is that? AND if a,b are both variables for floating-point numbers, is it acceptable if I use "a==b" as the condition in the "if function"? Could anybody help me out? Thanks a lot!

采纳的回答

Daniel Shub
Daniel Shub 2011-12-13
  3 个评论
Jan
Jan 2011-12-14
@Jiasen: It is a good idea to read the complete FAQ - why not takine advantage from the problems of others...

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by