Skip to content

catsSyntaxEq returns false for equality of positive and negative zero in Option #4807

@charlesandrews

Description

@charlesandrews

With versions:

  • Scala 3.3.3
  • cats-core 2.13.0

When comparing Options which contain doubles, catsSyntaxEq === unexpectedly returns false for comparisons of 0.0 and -0.0

scala> 0.0 === -0.0
val res2: Boolean = true

scala> Option(0.0) === Option(-0.0)
val res0: Boolean = false

This does not match Scala's behavior of

scala> Option(0.0) == Option(-0.0)
val res1: Boolean = true

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions