Skip to content

allunique(::AbstractRange) is fooled by very small step #58139

@mcabbott

Description

@mcabbott

The range defined in #58138 seems to fool unique and allunique:

julia> start = 0.7071067811865475;

julia> len = 1449;

julia> r1 = range(start, nextfloat(start), len) # works -- from 58138
0.7071067811865475:7.667286081665445e-20:0.7071067811865476

julia> unique(collect(r1))  # this is fine
2-element Vector{Float64}:
 0.7071067811865475
 0.7071067811865476

julia> allunique(r1)  # this is wrong
true

julia> collect(unique(r1))  # follows from allunique
1449-element Vector{Float64}:
 0.7071067811865475
 0.7071067811865475
 0.7071067811865475
 0.7071067811865475

Metadata

Metadata

Assignees

No one assigned

    Labels

    collectionsData structures holding multiple items, e.g. setsrangesEverything AbstractRange

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions