Table of Contents

Struct Numeric

Namespace
Artemis.Core
Assembly
Artemis.Core.dll

Represents a number, either decimal or not, with arbitrary precision.

Note: This struct is intended to be used by the node system when implementing your own Node. Usage outside that context is not recommended due to conversion overhead.

public readonly struct Numeric : IComparable<Numeric>, IConvertible
Implements

Constructors

Numeric(byte)

Creates a new instance of Numeric from a byte

public Numeric(byte value)

Parameters

value byte

Numeric(double)

Creates a new instance of Numeric from a double

public Numeric(double value)

Parameters

value double

Numeric(int)

Creates a new instance of Numeric from an int

public Numeric(int value)

Parameters

value int

Numeric(long)

Creates a new instance of Numeric from a long

public Numeric(long value)

Parameters

value long

Numeric(object?)

Creates a new instance of Numeric from an object

public Numeric(object? pathValue)

Parameters

pathValue object

Numeric(float)

Creates a new instance of Numeric from a float

public Numeric(float value)

Parameters

value float

Methods

CompareTo(Numeric)

Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

public int CompareTo(Numeric other)

Parameters

other Numeric

An object to compare with this instance.

Returns

int

A value that indicates the relative order of the objects being compared. The return value has these meanings:

Value Meaning
Less than zero This instance precedes other in the sort order.
Zero This instance occurs in the same position in the sort order as other.
Greater than zero This instance follows other in the sort order.

Equals(Numeric)

Indicates whether this instance and a specified numeric are equal

public bool Equals(Numeric other)

Parameters

other Numeric

The numeric to compare with the current instance

Returns

bool

true if this numeric and the provided other are equal; otherwise, false.

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

GetTypeCode()

Returns the TypeCode for this instance.

public TypeCode GetTypeCode()

Returns

TypeCode

The enumerated constant that is the TypeCode of the class or value type that implements this interface.

IsTypeCompatible(Type?)

Returns a boolean indicating whether the provided type can be used as a Numeric.

public static bool IsTypeCompatible(Type? type)

Parameters

type Type

Returns

bool

ToBoolean(IFormatProvider?)

Converts the value of this instance to an equivalent Boolean value using the specified culture-specific formatting information.

public bool ToBoolean(IFormatProvider? provider)

Parameters

provider IFormatProvider

An IFormatProvider interface implementation that supplies culture-specific formatting information.

Returns

bool

A Boolean value equivalent to the value of this instance.

ToByte(IFormatProvider?)

Converts the value of this instance to an equivalent 8-bit unsigned integer using the specified culture-specific formatting information.

public byte ToByte(IFormatProvider? provider)

Parameters

provider IFormatProvider

An IFormatProvider interface implementation that supplies culture-specific formatting information.

Returns

byte

An 8-bit unsigned integer equivalent to the value of this instance.

ToChar(IFormatProvider?)

Converts the value of this instance to an equivalent Unicode character using the specified culture-specific formatting information.

public char ToChar(IFormatProvider? provider)

Parameters

provider IFormatProvider

An IFormatProvider interface implementation that supplies culture-specific formatting information.

Returns

char

A Unicode character equivalent to the value of this instance.

ToDateTime(IFormatProvider?)

Converts the value of this instance to an equivalent DateTime using the specified culture-specific formatting information.

public DateTime ToDateTime(IFormatProvider? provider)

Parameters

provider IFormatProvider

An IFormatProvider interface implementation that supplies culture-specific formatting information.

Returns

DateTime

A DateTime instance equivalent to the value of this instance.

ToDecimal(IFormatProvider?)

Converts the value of this instance to an equivalent decimal number using the specified culture-specific formatting information.

public decimal ToDecimal(IFormatProvider? provider)

Parameters

provider IFormatProvider

An IFormatProvider interface implementation that supplies culture-specific formatting information.

Returns

decimal

A decimal number equivalent to the value of this instance.

ToDouble(IFormatProvider?)

Converts the value of this instance to an equivalent double-precision floating-point number using the specified culture-specific formatting information.

public double ToDouble(IFormatProvider? provider)

Parameters

provider IFormatProvider

An IFormatProvider interface implementation that supplies culture-specific formatting information.

Returns

double

A double-precision floating-point number equivalent to the value of this instance.

ToInt16(IFormatProvider?)

Converts the value of this instance to an equivalent 16-bit signed integer using the specified culture-specific formatting information.

public short ToInt16(IFormatProvider? provider)

Parameters

provider IFormatProvider

An IFormatProvider interface implementation that supplies culture-specific formatting information.

Returns

short

An 16-bit signed integer equivalent to the value of this instance.

ToInt32(IFormatProvider?)

Converts the value of this instance to an equivalent 32-bit signed integer using the specified culture-specific formatting information.

public int ToInt32(IFormatProvider? provider)

Parameters

provider IFormatProvider

An IFormatProvider interface implementation that supplies culture-specific formatting information.

Returns

int

An 32-bit signed integer equivalent to the value of this instance.

ToInt64(IFormatProvider?)

Converts the value of this instance to an equivalent 64-bit signed integer using the specified culture-specific formatting information.

public long ToInt64(IFormatProvider? provider)

Parameters

provider IFormatProvider

An IFormatProvider interface implementation that supplies culture-specific formatting information.

Returns

long

An 64-bit signed integer equivalent to the value of this instance.

ToSByte(IFormatProvider?)

Converts the value of this instance to an equivalent 8-bit signed integer using the specified culture-specific formatting information.

public sbyte ToSByte(IFormatProvider? provider)

Parameters

provider IFormatProvider

An IFormatProvider interface implementation that supplies culture-specific formatting information.

Returns

sbyte

An 8-bit signed integer equivalent to the value of this instance.

ToSingle(IFormatProvider?)

Converts the value of this instance to an equivalent single-precision floating-point number using the specified culture-specific formatting information.

public float ToSingle(IFormatProvider? provider)

Parameters

provider IFormatProvider

An IFormatProvider interface implementation that supplies culture-specific formatting information.

Returns

float

A single-precision floating-point number equivalent to the value of this instance.

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.

ToString(IFormatProvider?)

Converts the value of this instance to an equivalent string using the specified culture-specific formatting information.

public string ToString(IFormatProvider? provider)

Parameters

provider IFormatProvider

An IFormatProvider interface implementation that supplies culture-specific formatting information.

Returns

string

A string instance equivalent to the value of this instance.

ToType(Type, IFormatProvider?)

Converts the value of this instance to an object of the specified Type that has an equivalent value, using the specified culture-specific formatting information.

public object ToType(Type conversionType, IFormatProvider? provider)

Parameters

conversionType Type

The Type to which the value of this instance is converted.

provider IFormatProvider

An IFormatProvider interface implementation that supplies culture-specific formatting information.

Returns

object

An object instance of type conversionType whose value is equivalent to the value of this instance.

ToUInt16(IFormatProvider?)

Converts the value of this instance to an equivalent 16-bit unsigned integer using the specified culture-specific formatting information.

public ushort ToUInt16(IFormatProvider? provider)

Parameters

provider IFormatProvider

An IFormatProvider interface implementation that supplies culture-specific formatting information.

Returns

ushort

An 16-bit unsigned integer equivalent to the value of this instance.

ToUInt32(IFormatProvider?)

Converts the value of this instance to an equivalent 32-bit unsigned integer using the specified culture-specific formatting information.

public uint ToUInt32(IFormatProvider? provider)

Parameters

provider IFormatProvider

An IFormatProvider interface implementation that supplies culture-specific formatting information.

Returns

uint

An 32-bit unsigned integer equivalent to the value of this instance.

ToUInt64(IFormatProvider?)

Converts the value of this instance to an equivalent 64-bit unsigned integer using the specified culture-specific formatting information.

public ulong ToUInt64(IFormatProvider? provider)

Parameters

provider IFormatProvider

An IFormatProvider interface implementation that supplies culture-specific formatting information.

Returns

ulong

An 64-bit unsigned integer equivalent to the value of this instance.

TryParse(string?, out Numeric)

Converts the string representation of a number into a numeric. A return value indicates whether the conversion succeeded or failed.

public static bool TryParse(string? s, out Numeric result)

Parameters

s string

A string representing a number to convert.

result Numeric

When this method returns, contains numeric equivalent to the numeric value or symbol contained in s, if the conversion succeeded, or zero if the conversion failed.

Returns

bool

true if s was converted successfully; otherwise, false.

Operators

operator +(Numeric, Numeric)

public static Numeric operator +(Numeric a, Numeric b)

Parameters

a Numeric
b Numeric

Returns

Numeric

operator --(Numeric)

public static Numeric operator --(Numeric a)

Parameters

a Numeric

Returns

Numeric

operator /(Numeric, Numeric)

public static Numeric operator /(Numeric a, Numeric b)

Parameters

a Numeric
b Numeric

Returns

Numeric

operator ==(Numeric, Numeric)

public static bool operator ==(Numeric left, Numeric right)

Parameters

left Numeric
right Numeric

Returns

bool

operator >(Numeric, Numeric)

public static bool operator >(Numeric a, Numeric b)

Parameters

a Numeric
b Numeric

Returns

bool

operator >=(Numeric, Numeric)

public static bool operator >=(Numeric left, Numeric right)

Parameters

left Numeric
right Numeric

Returns

bool

implicit operator byte(Numeric)

public static implicit operator byte(Numeric p)

Parameters

p Numeric

Returns

byte

implicit operator decimal(Numeric)

public static implicit operator decimal(Numeric p)

Parameters

p Numeric

Returns

decimal

implicit operator double(Numeric)

public static implicit operator double(Numeric p)

Parameters

p Numeric

Returns

double

implicit operator int(Numeric)

public static implicit operator int(Numeric p)

Parameters

p Numeric

Returns

int

implicit operator long(Numeric)

public static implicit operator long(Numeric p)

Parameters

p Numeric

Returns

long

implicit operator float(Numeric)

public static implicit operator float(Numeric p)

Parameters

p Numeric

Returns

float

implicit operator Numeric(byte)

public static implicit operator Numeric(byte b)

Parameters

b byte

Returns

Numeric

implicit operator Numeric(double)

public static implicit operator Numeric(double d)

Parameters

d double

Returns

Numeric

implicit operator Numeric(int)

public static implicit operator Numeric(int i)

Parameters

i int

Returns

Numeric

implicit operator Numeric(float)

public static implicit operator Numeric(float f)

Parameters

f float

Returns

Numeric

operator ++(Numeric)

public static Numeric operator ++(Numeric a)

Parameters

a Numeric

Returns

Numeric

operator !=(Numeric, Numeric)

public static bool operator !=(Numeric left, Numeric right)

Parameters

left Numeric
right Numeric

Returns

bool

operator <(Numeric, Numeric)

public static bool operator <(Numeric a, Numeric b)

Parameters

a Numeric
b Numeric

Returns

bool

operator <=(Numeric, Numeric)

public static bool operator <=(Numeric left, Numeric right)

Parameters

left Numeric
right Numeric

Returns

bool

operator %(Numeric, Numeric)

public static Numeric operator %(Numeric a, Numeric b)

Parameters

a Numeric
b Numeric

Returns

Numeric

operator *(Numeric, Numeric)

public static Numeric operator *(Numeric a, Numeric b)

Parameters

a Numeric
b Numeric

Returns

Numeric

operator -(Numeric, Numeric)

public static Numeric operator -(Numeric a, Numeric b)

Parameters

a Numeric
b Numeric

Returns

Numeric

operator -(Numeric)

public static Numeric operator -(Numeric a)

Parameters

a Numeric

Returns

Numeric

operator +(Numeric)

public static Numeric operator +(Numeric a)

Parameters

a Numeric

Returns

Numeric