Last active
February 21, 2018 14:30
-
-
Save danslapman/10429c00762c5d92388c5cc95fa094d1 to your computer and use it in GitHub Desktop.
Generic power operator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
implicit class PowerOp[T <: AnyVal](val value: T) extends AnyVal { | |
import Numeric.Implicits._ | |
import scala.{math => scmath} | |
@inline def **(power: T)(implicit numeric: Numeric[T]): Double = | |
scmath.pow(value.toDouble(), power.toDouble()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment