trait TolerantNumerics extends AnyRef
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
- Source
 - TolerantNumerics.scala
 
- Alphabetic
 - By Inheritance
 
- TolerantNumerics
 - AnyRef
 - Any
 
- Hide All
 - Show All
 
- Public
 - All
 
Value Members
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        !=(arg0: Any): Boolean
      
      
      
- Definition Classes
 - AnyRef → Any
 
 - 
      
      
      
        
      
    
      
        final 
        def
      
      
        ##(): Int
      
      
      
- Definition Classes
 - AnyRef → Any
 
 - 
      
      
      
        
      
    
      
        final 
        def
      
      
        ==(arg0: Any): Boolean
      
      
      
- Definition Classes
 - AnyRef → Any
 
 - 
      
      
      
        
      
    
      
        final 
        def
      
      
        asInstanceOf[T0]: T0
      
      
      
- Definition Classes
 - Any
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        clone(): AnyRef
      
      
      
- Attributes
 - protected[java.lang]
 - Definition Classes
 - AnyRef
 - Annotations
 - @native() @throws( ... )
 
 - 
      
      
      
        
      
    
      
        final 
        def
      
      
        eq(arg0: AnyRef): Boolean
      
      
      
- Definition Classes
 - AnyRef
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        equals(arg0: Any): Boolean
      
      
      
- Definition Classes
 - AnyRef → Any
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        finalize(): Unit
      
      
      
- Attributes
 - protected[java.lang]
 - Definition Classes
 - AnyRef
 - Annotations
 - @throws( classOf[java.lang.Throwable] )
 
 - 
      
      
      
        
      
    
      
        final 
        def
      
      
        getClass(): Class[_]
      
      
      
- Definition Classes
 - AnyRef → Any
 - Annotations
 - @native()
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        hashCode(): Int
      
      
      
- Definition Classes
 - AnyRef → Any
 - Annotations
 - @native()
 
 - 
      
      
      
        
      
    
      
        final 
        def
      
      
        isInstanceOf[T0]: Boolean
      
      
      
- Definition Classes
 - Any
 
 - 
      
      
      
        
      
    
      
        final 
        def
      
      
        ne(arg0: AnyRef): Boolean
      
      
      
- Definition Classes
 - AnyRef
 
 - 
      
      
      
        
      
    
      
        final 
        def
      
      
        notify(): Unit
      
      
      
- Definition Classes
 - AnyRef
 - Annotations
 - @native()
 
 - 
      
      
      
        
      
    
      
        final 
        def
      
      
        notifyAll(): Unit
      
      
      
- Definition Classes
 - AnyRef
 - Annotations
 - @native()
 
 - 
      
      
      
        
      
    
      
        final 
        def
      
      
        synchronized[T0](arg0: ⇒ T0): T0
      
      
      
- Definition Classes
 - AnyRef
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        toString(): String
      
      
      
- Definition Classes
 - AnyRef → Any
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        tolerantByteEquality(tolerance: Byte): Equality[Byte]
      
      
      
Provides an
Equalityinstance forBytes that compares for equality with the passed tolerance.Provides an
Equalityinstance forBytes that compares for equality with the passed tolerance.- tolerance
 the tolerance with which the returned
Equalitywill compareBytes.- returns
 an
Equalitythat comparesBytes using the passed tolerance.
 - 
      
      
      
        
      
    
      
        
        def
      
      
        tolerantDoubleEquality(tolerance: Double): Equality[Double]
      
      
      
Provides an
Equalityinstance forDoubles that compares for equality with the passed tolerance.Provides an
Equalityinstance forDoubles that compares for equality with the passed tolerance.- tolerance
 the tolerance with which the returned
Equalitywill compareDoubles.- returns
 an
Equalitythat comparesDoubles using the passed tolerance.
 - 
      
      
      
        
      
    
      
        
        def
      
      
        tolerantEquivalence[N](tolerance: N)(implicit arg0: Numeric[N]): Equivalence[N]
      
      
      
Provides an
Equivalence[N]instance for any type for which aNumeric[N]is available that comparesNs for equality with the passed tolerance.Provides an
Equivalence[N]instance for any type for which aNumeric[N]is available that comparesNs for equality with the passed tolerance.- tolerance
 the tolerance with which the returned
Equalitywill compareNumerics.- returns
 an
Equivalencethat comparesNumerics using the passed tolerance.
 - 
      
      
      
        
      
    
      
        
        def
      
      
        tolerantFloatEquality(tolerance: Float): Equality[Float]
      
      
      
Provides an
Equalityinstance forFloats that compares for equality with the passed tolerance.Provides an
Equalityinstance forFloats that compares for equality with the passed tolerance.- tolerance
 the tolerance with which the returned
Equalitywill compareFloats.- returns
 an
Equalitythat comparesFloats using the passed tolerance.
 - 
      
      
      
        
      
    
      
        
        def
      
      
        tolerantIntEquality(tolerance: Int): Equality[Int]
      
      
      
Provides an
Equalityinstance forInts that compares for equality with the passed tolerance.Provides an
Equalityinstance forInts that compares for equality with the passed tolerance.- tolerance
 the tolerance with which the returned
Equalitywill compareInts.- returns
 an
Equalitythat comparesInts using the passed tolerance.
 - 
      
      
      
        
      
    
      
        
        def
      
      
        tolerantLongEquality(tolerance: Long): Equality[Long]
      
      
      
Provides an
Equalityinstance forLongs that compares for equality with the passed tolerance.Provides an
Equalityinstance forLongs that compares for equality with the passed tolerance.- tolerance
 the tolerance with which the returned
Equalitywill compareLongs.- returns
 an
Equalitythat comparesLongs using the passed tolerance.
 - 
      
      
      
        
      
    
      
        
        def
      
      
        tolerantShortEquality(tolerance: Short): Equality[Short]
      
      
      
Provides an
Equalityinstance forShorts that compares for equality with the passed tolerance.Provides an
Equalityinstance forShorts that compares for equality with the passed tolerance.- tolerance
 the tolerance with which the returned
Equalitywill compareShorts.- returns
 an
Equalitythat comparesShorts using the passed tolerance.
 - 
      
      
      
        
      
    
      
        final 
        def
      
      
        wait(): Unit
      
      
      
- Definition Classes
 - AnyRef
 - Annotations
 - @throws( ... )
 
 - 
      
      
      
        
      
    
      
        final 
        def
      
      
        wait(arg0: Long, arg1: Int): Unit
      
      
      
- Definition Classes
 - AnyRef
 - Annotations
 - @throws( ... )
 
 - 
      
      
      
        
      
    
      
        final 
        def
      
      
        wait(arg0: Long): Unit
      
      
      
- Definition Classes
 - AnyRef
 - Annotations
 - @native() @throws( ... )