Approximate

com.phasmidsoftware.number.core.misc.Approximate
trait Approximate[X]

The Approximate trait provides a mechanism to compute approximate representations of values of type X as Double. Implementations of this trait define how to compute this approximation while adhering to a specified maximum allowable error.

This is particularly useful for applications where an approximation with controlled precision is sufficient and can improve performance.

It operates based on an implicit epsilon value, which determines the acceptable error tolerance between the true value and the approximate result.

Type parameters

X

The type of the input object to be approximated.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def toDouble(x: X)(implicit epsilon: Double): Double

Evaluate this Approximatable object as a Double such that the absolute error between the true value and the result is less than epsilon.

Evaluate this Approximatable object as a Double such that the absolute error between the true value and the result is less than epsilon.

Value parameters

epsilon

the maximum allowable error.

x

the X value.

Attributes

Returns

the approximate value.