2using System.Reflection;
50 set => this.value = value;
122 if (E.AssociatedObjectValue is
double d)
123 return this.value == d;
131 return this.value.GetHashCode();
158 if (DesiredType == typeof(
byte))
160 if (this.value >=
byte.MinValue && this.value <=
byte.MaxValue)
162 Value = (byte)this.value;
166 else if (DesiredType == typeof(decimal))
168 Value = (decimal)this.value;
171 else if (DesiredType == typeof(
double))
173 Value = (double)this.value;
176 else if (DesiredType == typeof(
short))
178 if (this.value >=
short.MinValue && this.value <=
short.MaxValue)
180 Value = (short)this.value;
184 else if (DesiredType == typeof(
int))
186 if (this.value >=
int.MinValue && this.value <=
int.MaxValue)
188 Value = (int)this.value;
192 else if (DesiredType == typeof(
long))
194 if (this.value >=
long.MinValue && this.value <=
long.MaxValue)
196 Value = (long)this.value;
200 else if (DesiredType == typeof(sbyte))
202 if (this.value >= sbyte.MinValue &&
this.value <= sbyte.MaxValue)
204 Value = (sbyte)this.value;
208 else if (DesiredType == typeof(
float))
210 Value = (float)this.value;
213 else if (DesiredType == typeof(ushort))
215 if (this.value >= ushort.MinValue &&
this.value <= ushort.MaxValue)
217 Value = (ushort)this.value;
221 else if (DesiredType == typeof(uint))
223 if (this.value >= uint.MinValue &&
this.value <= uint.MaxValue)
225 Value = (uint)this.value;
229 else if (DesiredType == typeof(ulong))
231 if (this.value >= ulong.MinValue &&
this.value <= ulong.MaxValue)
233 Value = (ulong)this.value;
244 TypeInfo TI = DesiredType.GetTypeInfo();
248 Value = Enum.ToObject(DesiredType, (
int)this.value);
251 else if (TI.IsAssignableFrom(typeof(
double).GetTypeInfo()))
Base class for all types of elements.
abstract object AssociatedObjectValue
Associated object value.
Base class for all types of field elements.
Class managing a script expression.
static bool TryConvert(object Value, Type DesiredType, out object Result)
Tries to convert an object Value to an object of type DesiredType .
static string ToString(double Value)
Converts a value to a string, that can be parsed as part of an expression.
override IAbelianGroupElement Add(IAbelianGroupElement Element)
Tries to add an element to the current element.
override IRingElement Invert()
Inverts the element, if possible.
static readonly DoubleNumber ZeroElement
0
override IGroupElement Negate()
Negates the element.
override object AssociatedObjectValue
Associated object value.
override IAbelianGroupElement Zero
Returns the zero element of the group.
override ICommutativeRingElement Multiply(ICommutativeRingElement Element)
Tries to multiply an element to the current element.
override bool Equals(object obj)
Compares the element to another. If elements are equal.
double Value
Double value.
override int GetHashCode()
Calculates a hash code of the element. Hash code.
override ICommutativeRingWithIdentityElement One
Returns the identity element of the commutative ring with identity.
override bool TryConvertTo(Type DesiredType, out object Value)
Converts the value to a .NET type.
override IField AssociatedField
Associated Field.
override string ToString()
static readonly DoubleNumber OneElement
1
static readonly DoubleNumber ThreeElement
3
DoubleNumber(double Value)
Double-valued number.
static readonly DoubleNumber TwoElement
2
Pseudo-field of double numbers, as an approximation of the field of real numbers.
static readonly DoubleNumbers Instance
Instance of the set of complex numbers.
Basic interface for all types of abelian group elements.
Basic interface for all types of commutative ring elements.
Basic interface for all types of commutative ring with identity elements.
Basic interface for all types of elements.
Basic interface for all types of group elements.
Basic interface for all types of ring elements.
Basic interface for all types of fields.