Problem in understanding representation of floating point values

1 visualizzazione (ultimi 30 giorni)
I have one basic question. When i calculate 2/3, i am getting 0.6667 as the result. But when i calculate 2/2, i am getting 1,but not 1.0000. Why?
  1 Commento
David Goodmanson
David Goodmanson il 27 Feb 2019
Modificato: David Goodmanson il 27 Feb 2019
short answer: for integers, Matlab does not display zeros after the decimal point. There is no need, plus there is the advantage that 1 displays as 1, but e.g. 1.00000001 displays as 1.0000, indicating that there is something else going on.

Accedi per commentare.

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by