NumericIntent

public struct NumericIntent
A type for reverse engineering the intent behind a specific double value.

Constructors

NumericIntent

#
Create a new numeric intention wrapper.
public NumericIntent(
number
)

Properties

AsFraction

#
Gets the number as a fraction. If the number cannot be nicely represented as a ratio of integers, an unset fraction will be returned.
public Fraction AsFraction { get; }

AsIntegralRoot

#
Gets the integral root set for this number. Both parts of the returned tuple will be zero if this value is not the root of some integer.
public (long integer, byte order) AsIntegralRoot { get; }

IsFinite

#
Gets whether the number is finite in magnitude.
public bool IsFinite { get; }

IsFraction

#
Gets whether this value is near a fraction.
public bool IsFraction { get; }

IsInteger

#
Gets whether the number is integral.
public bool IsInteger { get; }

IsIntegralRoot

#
Gets whether this number can be represented as the root of an integer.
public bool IsIntegralRoot { get; }

IsNearInteger

#
Gets whether this value is near an integer.
public bool IsNearInteger { get; }

IsNearZero

#
Gets whether the number is close to zero.
public bool IsNearZero { get; }

IsNegative

#
Gets whether the value is positive.
public bool IsNegative { get; }

IsPositive

#
Gets whether the value is positive.
public bool IsPositive { get; }

IsValid

#
Gets whether the number is valid, i.e. not NaN.
public bool IsValid { get; }

Number

#
The original number.
public double Number { get; }

Methods

IsIntegerMultipleOfConstant

#
Gets whether this number is an integral multiple of some constant.
public bool IsIntegerMultipleOfConstant(
constant,
Constant to test against.
out int
multiple
Multiple of constant if true.
)
True if this number is indeed a multiple of 'constant'.

IsRationalMultipleOfConstant

#
Gets whether this number is a rational multiple of some constant.
public bool IsRationalMultipleOfConstant(
constant,
Constant to test against.
multiple
Multiple of constant if true.
)
True if this number is indeed a multiple of 'constant'.