if you run the following code,you will find the answer is not as you think:
a=0.14*100-14;
then a is not equal to zero,why?

 Accepted Answer

Star Strider
Star Strider on 29 Apr 2021

1 vote

Not a bug!
See Floating-Point Numbers for a detailed discussion.

2 Comments

Wang Zhongwei
Wang Zhongwei on 29 Apr 2021
thank you!The answer is useful!
Star Strider
Star Strider on 29 Apr 2021
As always, my pleasure!

Sign in to comment.

More Answers (0)

Categories

Community Treasure Hunt

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

Start Hunting!