Fixed in 1.7.0-rc2
https://github.com/JuliaLang/julia/issues/42291
julia> v = (1:5) .- 1/7
0.8571428571428572:1.0:4.857142857142858
julia> length(v)
5
julia> versioninfo()
Julia Version 1.7.0-rc2
Commit f23fc0d27a* (2021-10-20 12:45 UTC)
DEBUG build
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: Intel(R) Core(TM) i5-9400F CPU @ 2.90GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-12.0.1 (ORCJIT, skylake)
But …
julia> ( (1:5) .- 1/7 ) == ( collect(1:5) .- 1/7 )
false
julia> collect( (1:5) .- 1/7 ) == ( collect(1:5) .- 1/7 )
false
julia> collect( (1:5) .- 1/7 )
5-element Vector{Float64}:
0.8571428571428572
1.8571428571428572
2.857142857142857
3.857142857142857
4.857142857142858
julia> ( collect(1:5) .- 1/7 )
5-element Vector{Float64}:
0.8571428571428572
1.8571428571428572
2.857142857142857
3.857142857142857
4.857142857142857
Interesting floating point numbers
julia> 1 - 1/7 + 4
4.857142857142858
julia> 1 + 4 - 1/7
4.857142857142857
julia> (1 - 1/7 + 4) == (1 + 4 - 1/7)
false