Skip to content

Instantly share code, notes, and snippets.

@cqfd
Created June 10, 2018 14:55
Show Gist options
  • Save cqfd/0d495c5f7900526d04c93ca6b7188dbd to your computer and use it in GitHub Desktop.
Save cqfd/0d495c5f7900526d04c93ca6b7188dbd to your computer and use it in GitHub Desktop.
def pow(original: Real, exponent: Real): Real =
exponent match {
case Constant(exponent) => pow(original, exponent)
case _ => (original.log * exponent).exp
}
// delegates to def pow(original: Real, exponent: BigDecimal): Real = ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment