Decimal places when multiplying by 1.1
Show older comments
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?
Accepted Answer
More Answers (0)
Categories
Find more on String in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!