All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hammerlab.math.Interpolate.scala Maven / Gradle / Ivy

The newest version!
package org.hammerlab.math

import spire.implicits._
import spire.math._

trait Interpolate {
  def interpolate[N: Integral](start: N, end: N, delta: Rational): Rational =
    Rational(start.toSafeLong) + delta * Rational((end - start).toSafeLong)

  def interpolate[N: Numeric](start: N, end: N, delta: Double): Double =
    start.toDouble() + delta * (end - start).toDouble()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy