Class DoubleExtensions
Class DoubleExtensions.
Inheritance
System.Object
DoubleExtensions
Namespace: ISynergy.Framework.Core.Extensions
Assembly: ISynergy.Framework.Core.dll
Syntax
public static class DoubleExtensions : object
Fields
View SourceDefaultPrecision
The default precision to use when comparing two doubles
Declaration
public const double DefaultPrecision = null
Field Value
Type | Description |
---|---|
System.Double |
Methods
View SourceIsApproximatelyEqual(Double, Double, Double)
Test whether or not a double is equal to another double in the limits of a given precision
Declaration
public static bool IsApproximatelyEqual(this double a, double b, double delta = null)
Parameters
Type | Name | Description |
---|---|---|
System.Double | a | The first number |
System.Double | b | The second number |
System.Double | delta | The precision to use |
Returns
Type | Description |
---|---|
System.Boolean | True if they are approx. equal, false otherwise |
IsNegative(Double)
Test wether a double is negative
Declaration
public static bool IsNegative(this double value)
Parameters
Type | Name | Description |
---|---|---|
System.Double | value | The value to test |
Returns
Type | Description |
---|---|
System.Boolean | True, if the number is negative |
IsPositive(Double)
Test wether a double is positive
Declaration
public static bool IsPositive(this double value)
Parameters
Type | Name | Description |
---|---|---|
System.Double | value | The value to test |
Returns
Type | Description |
---|---|
System.Boolean | True, if the number is positive |
IsSmaller(Double, Double, Double)
Test wether or not a double is smaller than another one, as long as they are not approximately equal.
Declaration
public static bool IsSmaller(this double value1, double value2, double delta = null)
Parameters
Type | Name | Description |
---|---|---|
System.Double | value1 | The first number |
System.Double | value2 | The second number |
System.Double | delta | The precision to use |
Returns
Type | Description |
---|---|
System.Boolean | True if they are not approx. equal and the first number is less than the second. |
IsZero(Double)
Test wether a double is zero
Declaration
public static bool IsZero(this double value)
Parameters
Type | Name | Description |
---|---|---|
System.Double | value | The value to test |
Returns
Type | Description |
---|---|
System.Boolean | True, if the number is zero |