diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2014-01-08 06:30:54 -0800 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2014-01-08 06:30:54 -0800 |
commit | ea4a7659f4d9fa1ff9fc8feb5c9f4db732ecb4cf (patch) | |
tree | ea2e8d4f91075e5eb417a0d660115924d8ffce02 /src/library | |
parent | 5ec1b9e1df1f6000b5fc943097335d34bff0c79d (diff) | |
parent | b46d7aefd6eda36454cfd4cf339642e3c13c2022 (diff) | |
download | scala-ea4a7659f4d9fa1ff9fc8feb5c9f4db732ecb4cf.tar.gz scala-ea4a7659f4d9fa1ff9fc8feb5c9f4db732ecb4cf.tar.bz2 scala-ea4a7659f4d9fa1ff9fc8feb5c9f4db732ecb4cf.zip |
Merge pull request #3325 from clhodapp/fix/double.abs
Fix (postfix abs for -0.0)
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/math/Numeric.scala | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/library/scala/math/Numeric.scala b/src/library/scala/math/Numeric.scala index e6644c0dfc..eafbf96993 100644 --- a/src/library/scala/math/Numeric.scala +++ b/src/library/scala/math/Numeric.scala @@ -127,6 +127,8 @@ object Numeric { def toLong(x: Float): Long = x.toLong def toFloat(x: Float): Float = x def toDouble(x: Float): Double = x.toDouble + // logic in Numeric base trait mishandles abs(-0.0f) + override def abs(x: Float): Float = math.abs(x) } trait FloatIsFractional extends FloatIsConflicted with Fractional[Float] { def div(x: Float, y: Float): Float = x / y @@ -149,6 +151,8 @@ object Numeric { def toLong(x: Double): Long = x.toLong def toFloat(x: Double): Float = x.toFloat def toDouble(x: Double): Double = x + // logic in Numeric base trait mishandles abs(-0.0) + override def abs(x: Double): Double = math.abs(x) } trait DoubleIsFractional extends DoubleIsConflicted with Fractional[Double] { def div(x: Double, y: Double): Double = x / y |