catsSyntaxEq returns false for equality of positive and negative zero in Option
Open
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 5.5k
- Forks
- 1.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 5
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the comparison using Scala 3.3.3 and cats-core 2.13.0, starting from the catsSyntaxEq === entry point with Option(0.0) and Option(-0.0). Trace the Option equality behavior and add coverage showing the expected result agrees with Scala's Option equality; done when the positive and negative zero comparison behaves consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100