こういうやつです。小数 in BigDecimalにtoLongExactとかやると死ぬ。
scala> BigDecimal(5.55555).toIntExact java.lang.ArithmeticException: Rounding necessary at java.math.BigDecimal.commonNeedIncrement(BigDecimal.java:4148) at java.math.BigDecimal.needIncrement(BigDecimal.java:4204) at java.math.BigDecimal.divideAndRound(BigDecimal.java:4112) at java.math.BigDecimal.setScale(BigDecimal.java:2452) at java.math.BigDecimal.longValueExact(BigDecimal.java:3090) at java.math.BigDecimal.intValueExact(BigDecimal.java:3147) at scala.math.BigDecimal.toIntExact(BigDecimal.scala:738) ... 33 elided scala> BigDecimal(5.55555).toLongExact java.lang.ArithmeticException: Rounding necessary at java.math.BigDecimal.commonNeedIncrement(BigDecimal.java:4148) at java.math.BigDecimal.needIncrement(BigDecimal.java:4204) at java.math.BigDecimal.divideAndRound(BigDecimal.java:4112) at java.math.BigDecimal.setScale(BigDecimal.java:2452) at java.math.BigDecimal.longValueExact(BigDecimal.java:3090) at scala.math.BigDecimal.toLongExact(BigDecimal.scala:745) ... 33 elided scala> BigDecimal(5.55555).setScale(0, scala.math.BigDecimal.RoundingMode.CEILING) res2: scala.math.BigDecimal = 6