github.com

deprecate round on Int and Long · Issue #3235 · scala/bug

  • ️Wed Mar 05 2014

The problem is that math.round(n) (== java.lang.Math.round(n)) is only defined for Float and Double. If called with Int or Long arguments, they are converted to Float/Double, resulting in an loss of precision.
Example:

math.round(123456789)
res17: Int = 123456792