diff options
author | Niko Vuokko <niko.vuokko@gmail.com> | 2015-06-06 01:50:53 +0300 |
---|---|---|
committer | Niko Vuokko <niko.vuokko@gmail.com> | 2015-06-17 15:48:02 +0300 |
commit | 8e0bc0bffd31d994a6911116f170347004934c55 (patch) | |
tree | 5981ebbdfb39309d7a5d9caf146b4fb663151a7e /src/library | |
parent | 43a56fb5a1b6450ce2bdf8f73ab30ca1b16d0778 (diff) | |
download | scala-8e0bc0bffd31d994a6911116f170347004934c55.tar.gz scala-8e0bc0bffd31d994a6911116f170347004934c55.tar.bz2 scala-8e0bc0bffd31d994a6911116f170347004934c55.zip |
SI-9348 Fix missing last element in exclusive floating point ranges
Fix exclusive floating point ranges to contain also the last element
when the end-start difference is not an integer multiple of step.
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/math/Numeric.scala | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/library/scala/math/Numeric.scala b/src/library/scala/math/Numeric.scala index eafbf96993..9245798c17 100644 --- a/src/library/scala/math/Numeric.scala +++ b/src/library/scala/math/Numeric.scala @@ -134,7 +134,7 @@ object Numeric { def div(x: Float, y: Float): Float = x / y } trait FloatAsIfIntegral extends FloatIsConflicted with Integral[Float] { - def quot(x: Float, y: Float): Float = (BigDecimal(x) / BigDecimal(y)).floatValue + def quot(x: Float, y: Float): Float = (BigDecimal(x) quot BigDecimal(y)).floatValue def rem(x: Float, y: Float): Float = (BigDecimal(x) remainder BigDecimal(y)).floatValue } implicit object FloatIsFractional extends FloatIsFractional with Ordering.FloatOrdering @@ -158,7 +158,7 @@ object Numeric { def div(x: Double, y: Double): Double = x / y } trait DoubleAsIfIntegral extends DoubleIsConflicted with Integral[Double] { - def quot(x: Double, y: Double): Double = (BigDecimal(x) / BigDecimal(y)).doubleValue + def quot(x: Double, y: Double): Double = (BigDecimal(x) quot BigDecimal(y)).doubleValue def rem(x: Double, y: Double): Double = (BigDecimal(x) remainder BigDecimal(y)).doubleValue } @@ -178,7 +178,7 @@ object Numeric { def div(x: BigDecimal, y: BigDecimal): BigDecimal = x / y } trait BigDecimalAsIfIntegral extends BigDecimalIsConflicted with Integral[BigDecimal] { - def quot(x: BigDecimal, y: BigDecimal): BigDecimal = x / y + def quot(x: BigDecimal, y: BigDecimal): BigDecimal = x quot y def rem(x: BigDecimal, y: BigDecimal): BigDecimal = x remainder y } |