Skip to content

Commit

Permalink
typelevel#787 - tests have ordering and precision issues when run on …
Browse files Browse the repository at this point in the history
…clusters - inifinity protection
  • Loading branch information
chris-twiner committed Apr 10, 2024
1 parent e582962 commit 986891a
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,17 @@ object DoubleBehaviourUtils {
case null => None
case d: Double =>
nanHandler(d).map { d =>
BigDecimal(d).setScale(
6,
if (d > 0)
BigDecimal.RoundingMode.FLOOR
else
BigDecimal.RoundingMode.CEILING
)
if (d == Double.NegativeInfinity || d == Double.PositiveInfinity)
BigDecimal("1000000.000000") * (if (d == Double.PositiveInfinity) 1
else -1)
else
BigDecimal(d).setScale(
6,
if (d > 0)
BigDecimal.RoundingMode.FLOOR
else
BigDecimal.RoundingMode.CEILING
)
}
case _ => ???
}
Expand Down

0 comments on commit 986891a

Please sign in to comment.