NumericIntent

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

Constructors

NumericIntent

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

Properties

AsFraction

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

AsIntegralRoot

#
public (long integer, byte order) AsIntegralRoot { get; }
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.

IsFinite

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

IsFraction

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

IsInteger

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

IsIntegralRoot

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

IsNearInteger

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

IsNearZero

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

IsNegative

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

IsPositive

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

IsValid

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

Number

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

Methods

IsIntegerMultipleOfConstant

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

IsRationalMultipleOfConstant

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