You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is not necessarily a bug, it may be my lack of understanding. I was simply puzzled, since I was expecting 1.7 to be printed via "println" instead of 1.7000000000000002.
The text was updated successfully, but these errors were encountered:
See also #2333. If we integrate some of those fixes to ranges, which I have lying around on a branch somewhere, then this problem actually won't occur since you will get precisely 1.7 to the best possible floating-point representation.
I run the following naive "for" loop in order to check that I can iterate with a step size of my own preference (0.1 in this example):
for i = 1:0.1:2
println(i)
end
and I got the following output:
1.0
1.1
1.2
1.3
1.4
1.5
1.6
1.7000000000000002
1.8
1.9
2.0
I suspect it has to do with "println", because the comprehension
[i for i= 1:0.1:2]
prints out 1.7 instead of 1.7000000000000002:
11-element Float64 Array:
1.0
1.1
1.2
1.3
1.4
1.5
1.6
1.7
1.8
1.9
2.0
This is not necessarily a bug, it may be my lack of understanding. I was simply puzzled, since I was expecting 1.7 to be printed via "println" instead of 1.7000000000000002.
The text was updated successfully, but these errors were encountered: