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?

 Akzeptierte Antwort

Star Strider
Star Strider am 29 Apr. 2021

1 Stimme

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

2 Kommentare

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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Community Treasure Hunt

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

Start Hunting!

Translated by