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 Byte
s that compares for equality with the passed tolerance.
Provides an Equality
instance for Byte
s that compares for equality with the passed tolerance.
Value parameters
- tolerance
-
the tolerance with which the returned
Equality
will compareByte
s.
Attributes
- Returns
-
an
Equality
that comparesByte
s using the passed tolerance. - Source
- TolerantNumerics.scala
Provides an Equality
instance for Double
s that compares for equality with the passed tolerance.
Provides an Equality
instance for Double
s that compares for equality with the passed tolerance.
Value parameters
- tolerance
-
the tolerance with which the returned
Equality
will compareDouble
s.
Attributes
- Returns
-
an
Equality
that comparesDouble
s using the passed tolerance. - Source
- TolerantNumerics.scala
Provides an Equivalence[N]
instance for any type for which a Numeric[N]
is available that compares N
s for equality with the passed tolerance.
Provides an Equivalence[N]
instance for any type for which a Numeric[N]
is available that compares N
s for equality with the passed tolerance.
Value parameters
- tolerance
-
the tolerance with which the returned
Equality
will compareNumeric
s.
Attributes
- Returns
-
an
Equivalence
that comparesNumeric
s using the passed tolerance. - Source
- TolerantNumerics.scala
Provides an Equality
instance for Float
s that compares for equality with the passed tolerance.
Provides an Equality
instance for Float
s that compares for equality with the passed tolerance.
Value parameters
- tolerance
-
the tolerance with which the returned
Equality
will compareFloat
s.
Attributes
- Returns
-
an
Equality
that comparesFloat
s using the passed tolerance. - Source
- TolerantNumerics.scala
Provides an Equality
instance for Int
s that compares for equality with the passed tolerance.
Provides an Equality
instance for Int
s that compares for equality with the passed tolerance.
Value parameters
- tolerance
-
the tolerance with which the returned
Equality
will compareInt
s.
Attributes
- Returns
-
an
Equality
that comparesInt
s using the passed tolerance. - Source
- TolerantNumerics.scala
Provides an Equality
instance for Long
s that compares for equality with the passed tolerance.
Provides an Equality
instance for Long
s that compares for equality with the passed tolerance.
Value parameters
- tolerance
-
the tolerance with which the returned
Equality
will compareLong
s.
Attributes
- Returns
-
an
Equality
that comparesLong
s using the passed tolerance. - Source
- TolerantNumerics.scala
Provides an Equality
instance for Short
s that compares for equality with the passed tolerance.
Provides an Equality
instance for Short
s that compares for equality with the passed tolerance.
Value parameters
- tolerance
-
the tolerance with which the returned
Equality
will compareShort
s.
Attributes
- Returns
-
an
Equality
that comparesShort
s using the passed tolerance. - Source
- TolerantNumerics.scala