Provides Equality and Equivalence instances for Numeric types that compare for equality with a given tolerance.
Here's an example:
scala> import org.scalactic._ import org.scalactic._ scala> import TripleEquals._ import TripleEquals._ scala> 2.001 === 2.0 res0: Boolean = false scala> implicit val doubleEquality = TolerantNumerics.tolerantDoubleEquality(0.01) doubleEquality: org.scalactic.Equality[Double] = org.scalactic.TolerantNumerics$$anon$1@16c2bd13 scala> 2.001 === 2.0 res1: Boolean = true
Attributes
- Companion
- object
- Source
- TolerantNumerics.scala
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
object TolerantNumerics.type
Members list
Value members
Concrete methods
Provides an Equality instance for Bytes that compares for equality with the passed tolerance.
Provides an Equality instance for Bytes that compares for equality with the passed tolerance.
Value parameters
- tolerance
-
the tolerance with which the returned
Equalitywill compareBytes.
Attributes
- Returns
-
an
Equalitythat comparesBytes using the passed tolerance. - Source
- TolerantNumerics.scala
Provides an Equality instance for Doubles that compares for equality with the passed tolerance.
Provides an Equality instance for Doubles that compares for equality with the passed tolerance.
Value parameters
- tolerance
-
the tolerance with which the returned
Equalitywill compareDoubles.
Attributes
- Returns
-
an
Equalitythat comparesDoubles using the passed tolerance. - Source
- TolerantNumerics.scala
Provides an Equivalence[N] instance for any type for which a Numeric[N] is available that compares Ns for equality with the passed tolerance.
Provides an Equivalence[N] instance for any type for which a Numeric[N] is available that compares Ns for equality with the passed tolerance.
Value parameters
- tolerance
-
the tolerance with which the returned
Equalitywill compareNumerics.
Attributes
- Returns
-
an
Equivalencethat comparesNumerics using the passed tolerance. - Source
- TolerantNumerics.scala
Provides an Equality instance for Floats that compares for equality with the passed tolerance.
Provides an Equality instance for Floats that compares for equality with the passed tolerance.
Value parameters
- tolerance
-
the tolerance with which the returned
Equalitywill compareFloats.
Attributes
- Returns
-
an
Equalitythat comparesFloats using the passed tolerance. - Source
- TolerantNumerics.scala
Provides an Equality instance for Ints that compares for equality with the passed tolerance.
Provides an Equality instance for Ints that compares for equality with the passed tolerance.
Value parameters
- tolerance
-
the tolerance with which the returned
Equalitywill compareInts.
Attributes
- Returns
-
an
Equalitythat comparesInts using the passed tolerance. - Source
- TolerantNumerics.scala
Provides an Equality instance for Longs that compares for equality with the passed tolerance.
Provides an Equality instance for Longs that compares for equality with the passed tolerance.
Value parameters
- tolerance
-
the tolerance with which the returned
Equalitywill compareLongs.
Attributes
- Returns
-
an
Equalitythat comparesLongs using the passed tolerance. - Source
- TolerantNumerics.scala
Provides an Equality instance for Shorts that compares for equality with the passed tolerance.
Provides an Equality instance for Shorts that compares for equality with the passed tolerance.
Value parameters
- tolerance
-
the tolerance with which the returned
Equalitywill compareShorts.
Attributes
- Returns
-
an
Equalitythat comparesShorts using the passed tolerance. - Source
- TolerantNumerics.scala