Skip to content

Commit

Permalink
cannot inline fromInt or fromDouble due to multiple inheritance
Browse files Browse the repository at this point in the history
  • Loading branch information
erikerlandson committed Dec 26, 2023
1 parent 65a0478 commit 008fc6c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/src/main/scala-3/spire/std/double.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ trait DoubleIsField extends Field[Double] {
override inline def times(a: Double, b: Double): Double = a * b
inline def zero: Double = 0.0

override inline def fromInt(n: Int): Double = n.toDouble
override def fromInt(n: Int): Double = n

override inline def fromDouble(n: Double): Double = n
override def fromDouble(n: Double): Double = n
inline def div(a: Double, b: Double): Double = a / b
}

Expand Down
2 changes: 2 additions & 0 deletions core/src/main/scala/spire/math/Numeric.scala
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ private[math] class DoubleIsNumeric
with ConvertableToDouble
with DoubleIsReal
with Serializable {
override def fromInt(n: Int): Double = n
override def fromDouble(n: Double): Double = n
override def fromBigInt(n: BigInt): Double = n.toDouble
override def toDouble(n: Double): Double = n.toDouble
override def toRational(n: Double): Rational = super[DoubleIsReal].toRational(n)
Expand Down

0 comments on commit 008fc6c

Please sign in to comment.