Table of Contents

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

double

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

value double

The first value.

compare double

The second value.

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

value int

The first value.

compare int

The second value.

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

value double?

The first value.

compare double?

The second value.

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

value float?

The first value.

compare float?

The second value.

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

value float

The first value.

compare float

The second value.

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

value double

The first value.

compare double

The second value.

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

value double

The value to check is in range.

lower double

The lower range band.

upper double

The 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

value int

The value to check is in range.

lower int

The lower range band.

upper int

The 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

value float

The value to check is in range.

lower float

The lower range band.

upper float

The 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

value double

The first value.

compare double

The second value.

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

value double

The 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

value float

The value to check.

Returns

bool

True if zero; otherwise, false.