NumericsUtilities class

Class to help out with numeric issues, mostly due to floating point usage.

Since the floating point representation keeps a constant relative precision, comparison is done using relative error.

Be aware of the fact that the methods

  • {@link #dEq(double, double)}
  • {@link #fEq(float, float)}
can be used in the case of "simple" numerical comparison, while in the case of particular values that are generated through iterations the user/developer should consider to supply an epsilon value derived from the knowledge of the domain of the current problem and use the methods
  • {@link #dEq(double, double, double)}
  • {@link #fEq(float, float, float)}

@author Andrea Antonello (www.hydrologis.com)

Constructors

NumericsUtilities()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

HALF_LOG_2_PI double
Avoid repeated computation of log of 2 PI in logGamma
final
LANCZOS List<double>
Lanczos coefficients
final

Static Methods

dEq(double a, double b, double epsilon) bool
Returns true if two doubles are considered equal based on a tolerance of {@value #D_TOLERANCE}.
gamma(double x) double
isBetween(double value, List<double> ranges) bool
Check if value is inside a ND interval (bounds included).
logGamma(double x) double
Gamma function ported from the apache math package.
normalize(double max, double min, double value, double normMax) double
Normalizes a value for a given normalization max (assuming the lower is 0).
pythagoras(double d1, double d2) double
Calculates the hypothenuse as of the Pythagorean theorem.

Constants

RADTODEG → const double
Radiants to degrees conversion factor.