Skip to content

SplayTreeSet treats -0 and 0 as different numbers #675

Closed as not planned
Closed as not planned
@xommmax

Description

@xommmax
  final mSet = Set<double>();
  mSet.addAll([-0.0, 0.0]);
  print(mSet);

outputs {0}

Meanwhile:

  final mSet = SplayTreeSet<double>();
  mSet.addAll([-0.0, 0.0]);
  print(mSet);

outputs {-0.0, 0}

I don't know if it's expected, but

print(-0.0 == 0.0);

gives me true, so I expect Set (and any of its implementations) to treat it as the same number

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions