DoubleExtensions Class
Provides extension methods for the type double.
public static class DoubleExtensions
- Inheritance:
- object object
Methods
ConvertDegreesToRadians(double)
Converts an angle from degrees to radians.
public static double ConvertDegreesToRadians(this double angle)
Parameter | Type | Description |
---|---|---|
angle | double | The angle value, in degrees (0 - 359.99). |
Returns
ConvertRadiansToDegrees(double)
Converts an angle from radians to degrees.
public static double ConvertRadiansToDegrees(this double angle)
Parameter | Type | Description |
---|---|---|
angle | double | The angle value, in radians. |
Returns
GetNormalizedDegreeAngle(double)
Returns a normalized degree angle value in the range of (0 - 359.99).
public static double GetNormalizedDegreeAngle(this double angle)
Parameter | Type | Description |
---|---|---|
angle | double | The angle value, in degrees. |
Returns
- double:
A normalized degree angle value.
IsEffectivelyEqual(double, double)
Determines whether the two values are close enough to be considered equal.
public static bool IsEffectivelyEqual(this double left, double right)
Parameter | Type | Description |
---|---|---|
left | double | The value on the left side of the comparison. |
right | double | The value on the left side of the comparison. |
Returns
- bool:
true
if the two values are close enough to be considered equal; otherwise,false
.
IsEffectivelyGreaterThan(double, double)
Determines whether the left value is effectively greater than the right value.
public static bool IsEffectivelyGreaterThan(this double left, double right)
Parameter | Type | Description |
---|---|---|
left | double | The value on the left side of the comparison. |
right | double | The value on the left side of the comparison. |
Returns
- bool:
true
if the left value is effectively greater than the right value; otherwise,false
.
IsEffectivelyGreaterThanOrEqual(double, double)
Determines whether the left value is effectively greater than or equal to the right value.
public static bool IsEffectivelyGreaterThanOrEqual(this double left, double right)
Parameter | Type | Description |
---|---|---|
left | double | The value on the left side of the comparison. |
right | double | The value on the left side of the comparison. |
Returns
- bool:
true
if the left value is effectively greater than or equal to the right value; otherwise,false
.
IsEffectivelyLessThan(double, double)
Determines whether the left value is effectively less than the right value.
public static bool IsEffectivelyLessThan(this double left, double right)
Parameter | Type | Description |
---|---|---|
left | double | The value on the left side of the comparison. |
right | double | The value on the left side of the comparison. |
Returns
- bool:
true
if the left value is effectively less than the right value; otherwise,false
.
IsEffectivelyLessThanOrEqual(double, double)
Determines whether the left value is effectively less than or equal to the right value.
public static bool IsEffectivelyLessThanOrEqual(this double left, double right)
Parameter | Type | Description |
---|---|---|
left | double | The value on the left side of the comparison. |
right | double | The value on the left side of the comparison. |
Returns
- bool:
true
if the left value is effectively less than or equal to the right value; otherwise,false
.
IsEffectivelyZero(double)
Determines whether the specified value is close enough to zero to be considered equal.
public static bool IsEffectivelyZero(this double value)
Parameter | Type | Description |
---|---|---|
value | double | The value to compare with zero. |
Returns
- bool:
true
if the specified value is close enough to zero to be considered equal; otherwise,false
.
IsWithin(double, double, double)
Determines whether the two values are within a specified range.
public static bool IsWithin(this double left, double right, double difference)
Parameter | Type | Description |
---|---|---|
left | double | The value on the left side of the comparison. |
right | double | The value on the left side of the comparison. |
difference | double | The difference threshold. |
Returns
- bool:
true
if the two values within a specified range; otherwise,false
.
Range(double, double, double)
Returns the specified value constrained to the specified minimum and maximum values.
public static double Range(this double value, double minValue, double maxValue)
Parameter | Type | Description |
---|---|---|
value | double | The value to constrain. |
minValue | double | The minimum value. |
maxValue | double | The maximum value. |
Returns
- double:
The specified value constrained to the specified minimum and maximum values.
Round(double, RoundMode)
Returns a rounded number using the specified RoundMode.
public static double Round(this double value, RoundMode mode)
Parameter | Type | Description |
---|---|---|
value | double | The value to round. |
mode | RoundMode | The RoundMode to use. |