Numeric Class |
Namespace: DigitalRune.Mathematics
The Numeric type exposes the following members.
Name | Description | |
---|---|---|
AreEqual(Double, Double) |
Determines whether two values are equal (regarding the tolerance EpsilonD).
| |
AreEqual(Single, Single) |
Determines whether two values are equal (regarding the tolerance EpsilonF).
| |
AreEqual(Double, Double, Double) |
Determines whether two values are equal (regarding a specific tolerance).
| |
AreEqual(Single, Single, Single) |
Determines whether two values are equal (regarding a specific tolerance).
| |
ClampToZero(Double) |
Clamps near-zero values to zero.
| |
ClampToZero(Single) |
Clamps near-zero values to zero.
| |
ClampToZero(Double, Double) |
Clamps near-zero values to zero.
| |
ClampToZero(Single, Single) |
Clamps near-zero values to zero.
| |
Compare(Double, Double) |
Compares two double values (regarding the tolerance
EpsilonD).
| |
Compare(Single, Single) |
Compares two float values (regarding the tolerance
EpsilonF).
| |
Compare(Double, Double, Double) |
Compares two double values (regarding a specific tolerance).
| |
Compare(Single, Single, Single) |
Compares two float values (regarding a specific tolerance).
| |
GetSignificantBitsSigned |
Gets the significant bits of a floating-point number, which can be used for rough
comparisons or sorting. (The floating-point number can negative or positive.)
| |
GetSignificantBitsUnsigned |
Gets the significant bits of a floating-point number, which can be used for rough
comparisons or sorting. (The floating-point number must be positive.)
| |
IsFinite(Double) |
Determines whether the specified value is finite.
| |
IsFinite(Single) |
Determines whether the specified value is finite.
| |
IsFiniteOrNaN(Double) |
Determines whether the specified value is finite or NaN.
| |
IsFiniteOrNaN(Single) |
Determines whether the specified value is finite or NaN.
| |
IsGreater(Double, Double) |
Determines whether a value is greater than another value (regarding the tolerance
EpsilonD).
| |
IsGreater(Single, Single) |
Determines whether a value is greater than another value (regarding the tolerance
EpsilonF).
| |
IsGreater(Double, Double, Double) |
Determines whether a value is greater than another value (regarding the specified
tolerance).
| |
IsGreater(Single, Single, Single) |
Determines whether a value is greater than another value (regarding the specified
tolerance).
| |
IsGreaterOrEqual(Double, Double) |
Determines whether a value is greater than or equal to another value (regarding the
tolerance EpsilonD).
| |
IsGreaterOrEqual(Single, Single) |
Determines whether a value is greater than or equal to another value (regarding the
tolerance EpsilonF).
| |
IsGreaterOrEqual(Double, Double, Double) |
Determines whether a value is greater than or equal to another value (regarding the
specified tolerance).
| |
IsGreaterOrEqual(Single, Single, Single) |
Determines whether a value is greater than or equal to another value (regarding the
specified tolerance).
| |
IsLess(Double, Double) |
Determines whether a value is less than another value (regarding the tolerance
EpsilonD).
| |
IsLess(Single, Single) |
Determines whether a value is less than another value (regarding the tolerance
EpsilonF).
| |
IsLess(Double, Double, Double) |
Determines whether a value is less than another value (regarding the specified tolerance).
| |
IsLess(Single, Single, Single) |
Determines whether a value is less than another value (regarding the specified tolerance).
| |
IsLessOrEqual(Double, Double) |
Determines whether a value is less than or equal to another value (regarding the tolerance
EpsilonD).
| |
IsLessOrEqual(Single, Single) |
Determines whether a value is less than or equal to another value (regarding the tolerance
EpsilonF).
| |
IsLessOrEqual(Double, Double, Double) |
Determines whether a value is less than or equal to another value (regarding the specified
tolerance).
| |
IsLessOrEqual(Single, Single, Single) |
Determines whether a value is less than or equal to another value (regarding the specified
tolerance).
| |
IsNaN(Double) |
Returns a value indicating whether the specified number is NaN.
| |
IsNaN(Single) |
Returns a value indicating whether the specified number is NaN.
| |
IsNegative(Double) |
Determines whether the specified value is negative.
| |
IsNegative(Single) |
Determines whether the specified value is negative.
| |
IsNegativeFinite(Double) |
Determines whether the specified value is negative finite.
| |
IsNegativeFinite(Single) |
Determines whether the specified value is negative finite.
| |
IsPositive(Double) |
Determines whether the specified value is positive.
| |
IsPositive(Single) |
Determines whether the specified value is positive.
| |
IsPositiveFinite(Double) |
Determines whether the specified value is positive finite.
| |
IsPositiveFinite(Single) |
Determines whether the specified value is positive finite.
| |
IsZero(Double) |
Determines whether a value is zero (regarding the tolerance
EpsilonD).
| |
IsZero(Single) |
Determines whether a value is zero (regarding the tolerance
EpsilonF).
| |
IsZero(Double, Double) |
Determines whether a value is zero (regarding a specific tolerance).
| |
IsZero(Single, Single) |
Determines whether a value is zero (regarding a specific tolerance).
| |
IsZeroOrNegativeFinite(Double) |
Determines whether the specified value is 0 or negative finite.
| |
IsZeroOrNegativeFinite(Single) |
Determines whether the specified value is 0 or negative finite.
| |
IsZeroOrPositiveFinite(Double) |
Determines whether the specified value is 0 or positive finite.
| |
IsZeroOrPositiveFinite(Single) |
Determines whether the specified value is 0 or positive finite.
|
Name | Description | |
---|---|---|
EpsilonD |
Gets or sets the tolerance value used for comparison of double values.
| |
EpsilonDSquared | ||
EpsilonF |
Gets or sets the tolerance value used for comparison of float values.
| |
EpsilonFSquared |
Floating-point values are difficult to compare for equality because of numerical errors. This class provides methods to compare floating-point values with regard to numerical errors.
To compare floating-point values a tolerance value epsilon will be used. Values smaller than the epsilon tolerance are treated as equal to 0. Floating-point values are considered equal when the difference is less than the epsilon tolerance.
Some methods allow to use a custom epsilon. If the method has no epsilon parameter, then the default values EpsilonF (for float) or EpsilonD (for double) are used.
Note that when two large floating-point numbers need to be compared a bigger epsilon tolerance needs to be used than when comparing a floating-point number with zero. When comparing two floating-point numbers using the default epsilon tolerance EpsilonF or EpsilonD (see AreEqual(Single, Single) or AreEqual(Double, Double)) then the epsilon values are automatically scaled to match the range and resolution of the floating-point numbers. When two floating-point numbers are compared using an explicit epsilon value (see AreEqual(Single, Single, Single) or AreEqual(Double, Double, Double)) then this epsilon value is used directly.