Skip to content

float ranges: if a+n*s == b, length(a:s:b) should be n+1 #20373

@StefanKarpinski

Description

@StefanKarpinski

See http://stackoverflow.com/questions/41985718/why-the-values-are-not-correctly-iterated-using-range-arrays/41986875#41986875.

Example:

julia> a, s, b = 3*0.05, 0.05, 4*0.05
(0.15000000000000002,0.05,0.2)

julia> a + 1*s == b
true

julia> length(a:s:b)
1

Rational lifting doesn't address this case since 0.15000000000000002 != 3/20 == 0.15.

Metadata

Metadata

Labels

collectionsData structures holding multiple items, e.g. sets

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions