Decimal places when multiplying by 1.1
Afficher commentaires plus anciens
Hello,
I just ran into this weird situation. I am just genuinely curious to know why Matlab behaves this way. Let's say that I have the following variables set in Matlab:
a = 0.9000
b = 1.1000
c = 1.2000
If I multiply the variables above by 100 I get the following results:
>> a * 100
ans =
90
>> b * 100
ans =
110.0000
>> c * 100
ans =
120
When multiplying a number by 1.1000 always yields four decimal places. I had a script running into error due to these decimal places - I had to use round() to get rid of the zeros.
Why is it that 1.1000 is the only thing returning multiplication with decimal places while other numbers such as 0.9000 and 1.2000 do not?
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur String dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!