SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.number
Interface NumberUtils.Comparable<T extends java.lang.Number>

Type Parameters:
T - a subclass of Number
All Known Implementing Classes:
Complex
Enclosing class:
NumberUtils

public static interface NumberUtils.Comparable<T extends java.lang.Number>

We need a precision parameter to determine whether two numbers are close enough to be treated as equal. All subclasses of Number must implement this interface to use NumberUtils.compare(java.lang.Number, java.lang.Number, double).


Method Summary
 int compare(java.lang.Number that, double epsilon)
          Compare this and that numbers up to a precision.
 

Method Detail

compare

int compare(java.lang.Number that,
            double epsilon)
Compare this and that numbers up to a precision.

Parameters:
that - a Number. Because a number can be represented in multiple ways, e.g., 0 = 0 + 0i, the implementation may need to check Object type.
epsilon - a precision parameter: when a number |x| ≤ ε, it is considered 0
Returns:
|this - that|

SuanShu, a Java numerical and statistical library

Copyright © 2011 Numerical Method Inc. Ltd. All Rights Reserved.