KSLMath
This class implements additional mathematical functions and determines the parameters of the floating point representation.
This is based on the DhbMath class of Didier Besset in "Object-Oriented Implementation of Numerical Methods", Morgan-Kaufmann
Properties
The default numerical precision. This represents an estimate of the precision expected for a general numerical computation. For example, two numbers x and y can be considered equal if the relative difference between them is less than the default numerical precision. This value has been defined as the square root of the machine precision
Largest argument for an exponential
Largest possible number
Largest positive value which, when added to 1.0, yields 0.
A variable that can be used in algorithms to specify the maximum number of iterations. This is an object property and thus a change will change it for any algorithm that depends on this variable. Must be greater than 0
Largest positive value which, when subtracted to 1.0, yields 0.
Smallest argument for the exponential
Smallest number different from zero.
Typical meaningful small number for numerical calculations. A number that can be added to some value without noticeably changing the result of the computation
Functions
Computes the binomial coefficient. Computes the number of combinations of size k that can be formed from n distinct objects.
Computes the binomial coefficient. Computes the number of combinations of size k that can be formed from n distinct objects.
Computes the natural logarithm of the factorial operator. ln(n!)
Round the specified value upward to the next scale value.
If x <= 0.0, then return ln(Double.MIN_VALUE). Since Double.MIN_VALUE is the smallest possible value that is closest to 0.0 without being 0.0. This prevents, ln(0.0) = -Infinity from appearing in calculations.
Converts a double to a boolean. 1.0 is true. Double.NEGATIVE_INFINITY is mapped to false, Double.POSITIVE_INFINITY is mapped to true, any other double values other are mapped to false.
Converts a double to a byte. If the double is outside the natural range, then the value is set to the minimum or maximum of the range. If within the range, the value is rounded to the nearest value. For example, 4.9999 is rounded to 5.0.
Converts a double to a float. Standard loss of precision as noted by the Java Language Specification will occur as per Double.floatValue()
Converts a double to an int. If the double is outside the natural range, then the value is set to the minimum or maximum of the range. If within the range, the value is rounded to the nearest value. For example, 4.9999 is rounded to 5.0.
Converts a double to a long. If the double is outside the natural range, then the value is set to the minimum or maximum of the range. If within the range, the value is rounded to the nearest value. For example, 4.9999 is rounded to 5.0.
Converts a double to a short. If the double is outside the natural range, then the value is set to the minimum or maximum of the range. If within the range, the value is rounded to the nearest value. For example, 4.9999 is rounded to 5.0.