For loops issue

julia> 1.1 - 2*0.1
0.9000000000000001

This is not Julia-specific, it’s due to the fact that standard floating-point arithmetic doesn’t exactly represent decimal values like 1.1 and 0.1. For example, in Python 3:

>>> 1.1 - 2*0.1
0.9000000000000001

See:

3 Likes