Class MathExtensions
- Namespace
- MADE.Data.Validation.Extensions
- Assembly
- MADE.Data.Validation.dll
Defines a collection of extensions for common mathematics expressions.
public static class MathExtensions
- Inheritance
-
MathExtensions
- Inherited Members
Fields
Epsilon
Gets a value for Epsilon.
public static readonly double Epsilon
Field Value
Methods
IsCloseTo(double, double)
Checks whether two values are close in value which have a precision point.
public static bool IsCloseTo(this double value, double compare)
Parameters
Returns
- bool
True if the values are close; otherwise, false.
IsCloseTo(int, int)
Checks whether two values are close in value.
public static bool IsCloseTo(this int value, int compare)
Parameters
Returns
- bool
True if the values are close; otherwise, false.
Exceptions
- OverflowException
Thrown if the value equals MinValue.
IsCloseTo(double?, double?)
Checks whether two values are close in value which have a precision point.
public static bool IsCloseTo(this double? value, double? compare)
Parameters
Returns
- bool
True if the values are close; otherwise, false.
IsCloseTo(float?, float?)
Checks whether two values are close in value which have a precision point.
public static bool IsCloseTo(this float? value, float? compare)
Parameters
Returns
- bool
True if the values are close; otherwise, false.
IsCloseTo(float, float)
Checks whether two values are close in value which have a precision point.
public static bool IsCloseTo(this float value, float compare)
Parameters
Returns
- bool
True if the values are close; otherwise, false.
IsGreaterThan(double, double)
Checks whether a value is significantly greater than another.
public static bool IsGreaterThan(this double value, double compare)
Parameters
Returns
- bool
True if the first value is greater than the second; otherwise, false.
IsInRange(double, double, double)
Checks whether a value is within a range.
public static bool IsInRange(this double value, double lower, double upper)
Parameters
valuedoubleThe value to check is in range.
lowerdoubleThe lower range band.
upperdoubleThe upper range band.
Returns
- bool
True if the value is in the range; otherwise, false.
Exceptions
- InvalidRangeException
Thrown if the range is invalid.
IsInRange(int, int, int)
Checks whether a value is within a range.
public static bool IsInRange(this int value, int lower, int upper)
Parameters
valueintThe value to check is in range.
lowerintThe lower range band.
upperintThe upper range band.
Returns
- bool
True if the value is in the range; otherwise, false.
Exceptions
- InvalidRangeException
Thrown if the range is invalid.
IsInRange(float, float, float)
Checks whether a value is within a range.
public static bool IsInRange(this float value, float lower, float upper)
Parameters
valuefloatThe value to check is in range.
lowerfloatThe lower range band.
upperfloatThe upper range band.
Returns
- bool
True if the value is in the range; otherwise, false.
Exceptions
- InvalidRangeException
Thrown if the range is invalid.
IsLessThan(double, double)
Checks whether a value is significantly less than another.
public static bool IsLessThan(this double value, double compare)
Parameters
Returns
- bool
True if the first value is less than the second; otherwise, false.
IsZero(double)
Checks whether a double value is zero.
public static bool IsZero(this double value)
Parameters
valuedoubleThe value to check.
Returns
- bool
True if zero; otherwise, false.
IsZero(float)
Checks whether a float value is zero.
public static bool IsZero(this float value)
Parameters
valuefloatThe value to check.
Returns
- bool
True if zero; otherwise, false.