Closed
Description
Reproduction steps
Scala version: 3.7.0 (but the bug is in the standard library)
scala> import scala.collection.immutable.ArraySeq
scala> ArraySeq(0.0f) == ArraySeq(-0.0f)
val res0: Boolean = false
scala> ArraySeq(0.0f).map(identity) == ArraySeq(-0.0f)
val res1: Boolean = true
Problem
ArraySeq equals should use ==
for floating point that follow IEEE semantics as done by Other Seqs.
The problem is that the specialization ofFloat and ofDouble delegate equals to java.util.Arrays.equals
but that is documented to not follow the normal ==
behavior https://docs.oracle.com/javase/8/docs/api/java/util/Arrays.html#equals-double:A-double:A-
Metadata
Metadata
Assignees
Labels
No labels