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?

 Réponse acceptée

Star Strider
Star Strider le 29 Avr 2021

1 vote

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

2 commentaires

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

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

Community Treasure Hunt

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

Start Hunting!

Translated by