com.rubecula.util
Class Math

java.lang.Object
  extended by com.rubecula.util.Math

public class Math
extends java.lang.Object

Author:
Robin Hillyard

Field Summary
static double EPSILON
          a suitable discriminant for comparing numeric values.
 
Constructor Summary
Math()
           
 
Method Summary
static int compare(double x, double y)
          Utility class method to compare two values with a tolerance of epsilon.
static int compare(double x, double y, double epsilon)
          Utility class method to compare two values with a tolerance of epsilon.
static int compare(java.lang.Number x, java.lang.Number y)
          Utility class method to compare two values with a tolerance of epsilon.
static int compare(java.lang.Number x, java.lang.Number y, double epsilon)
          Utility class method to compare two values with a tolerance of epsilon.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EPSILON

public static final double EPSILON
a suitable discriminant for comparing numeric values.

See Also:
Constant Field Values
Constructor Detail

Math

public Math()
Method Detail

compare

public static int compare(double x,
                          double y)
Utility class method to compare two values with a tolerance of epsilon. If the difference between x and y is less than epsilon, 0 is returned, else we return the result of Double.compare(double, double) for x and y.

Parameters:
x -
y -
Returns:
-1, 0 or 1 as x is less than, equal to or greater than y.

compare

public static int compare(double x,
                          double y,
                          double epsilon)
Utility class method to compare two values with a tolerance of epsilon. If the difference between x and y is less than epsilon, 0 is returned, else we return the result of Double.compare(double, double) for x and y.

Parameters:
x -
y -
epsilon -
Returns:
-1, 0 or 1 as x is less than, equal to or greater than y.

compare

public static int compare(java.lang.Number x,
                          java.lang.Number y)
Utility class method to compare two values with a tolerance of epsilon. If the difference between x and y is less than epsilon, 0 is returned, else we return the result of Double.compare(double, double) for x and y.

Parameters:
x -
y -
Returns:
-1, 0 or 1 as x is less than, equal to or greater than y.

compare

public static int compare(java.lang.Number x,
                          java.lang.Number y,
                          double epsilon)
Utility class method to compare two values with a tolerance of epsilon. If the difference between x and y is less than epsilon, 0 is returned, else we return the result of Double.compare(double, double) for x and y.

Parameters:
x -
y -
epsilon -
Returns:
-1, 0 or 1 as x is less than, equal to or greater than y.


Copyright © 2010 Rubecula Software, LLC. All Rights Reserved.