edu.uci.ics.jung.utils
Class NumericalPrecision

java.lang.Object
  extended byedu.uci.ics.jung.utils.NumericalPrecision

public final class NumericalPrecision
extends java.lang.Object

Implements additional mathematical functions to within numerical precision tolerances, and determines the parameters of the floating point representation.


Constructor Summary
NumericalPrecision()
           
 
Method Summary
static double defaultNumericalPrecision()
           
static boolean equal(double a, double b)
           
static boolean equal(double a, double b, double precision)
           
static double getLargestExponentialArgument()
           
static double getLargestNumber()
          (c) Copyrights Didier BESSET, 1999, all rights reserved.
static double getMachinePrecision()
           
static double getNegativeMachinePrecision()
           
static int getRadix()
           
static double getSmallestNumber()
           
static void printParameters(java.io.PrintStream printStream)
           
static void reset()
           
static double roundTo(double value, double scale)
          This method returns the specified value rounded to the nearest integer multiple of the specified scale.
static double roundToScale(double value, boolean integerValued)
          Round the specified value upward to the next scale value.
static double smallNumber()
          Returns the smallest number that the system can handle.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NumericalPrecision

public NumericalPrecision()
Method Detail

defaultNumericalPrecision

public static double defaultNumericalPrecision()

equal

public static boolean equal(double a,
                            double b)
Parameters:
a - double
b - double
Returns:
boolean true if the difference between a and b is less than the default numerical precision

equal

public static boolean equal(double a,
                            double b,
                            double precision)
Parameters:
a - double
b - double
precision - double
Returns:
boolean true if the relative difference between a and b is less than precision

getLargestExponentialArgument

public static double getLargestExponentialArgument()

getLargestNumber

public static double getLargestNumber()
(c) Copyrights Didier BESSET, 1999, all rights reserved.


getMachinePrecision

public static double getMachinePrecision()

getNegativeMachinePrecision

public static double getNegativeMachinePrecision()

getRadix

public static int getRadix()

getSmallestNumber

public static double getSmallestNumber()

printParameters

public static void printParameters(java.io.PrintStream printStream)

reset

public static void reset()

roundTo

public static double roundTo(double value,
                             double scale)
This method returns the specified value rounded to the nearest integer multiple of the specified scale.

Parameters:
value - number to be rounded
scale - defining the rounding scale
Returns:
rounded value

roundToScale

public static double roundToScale(double value,
                                  boolean integerValued)
Round the specified value upward to the next scale value.

Parameters:
value - the value to be rounded.
integerValued - a flag specified whether integer scale are used, otherwise double scale is used.
Returns:
a number rounded upward to the next scale value.

smallNumber

public static double smallNumber()
Returns the smallest number that the system can handle.

Returns:
double The smallest number the machine can handle.