How to subtract two close numbers?

2 vues (au cours des 30 derniers jours)
kamiR fardi
kamiR fardi le 16 Oct 2019
Commenté : kamiR fardi le 16 Oct 2019
Hi!
I've compiled the code below and i don't know why it doesn't give exact zero.
I'll appreciate if someone helps me.
format long
x=5.4;
y=x-5;
z=y-0.4;
disp(z)

Réponse acceptée

Stephen23
Stephen23 le 16 Oct 2019
Modifié(e) : Stephen23 le 16 Oct 2019
  1 commentaire
kamiR fardi
kamiR fardi le 16 Oct 2019
Thank you so much!

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by