30.0 * 0.009 # => 0.26999999999999996
Does anybody know why this is not 0.27
?
Any recommendations on what to do about this?
30.0 * 0.009 # => 0.26999999999999996
Does anybody know why this is not 0.27
?
Any recommendations on what to do about this?
Since you already found materials on the why subject, I will just answer the what to do part of the question. If you absolutely don't want to approximate, you have to use rational numbers:
30 * 0.009r # => (27/100)