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

3 views (last 30 days)
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!

Accepted Answer

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

Sign in to comment.

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!