private static ValueStructure LocalConvertFrom(ValueStructure value)
        {
            IntegerValue inv = value as IntegerValue;

            if (inv != null)
            {
                return(new ComplexValue(inv));
            }
            RationalValue rav = value as RationalValue;

            if (rav != null)
            {
                return(new ComplexValue(rav));
            }
            RealValue rev = value as RealValue;

            if (rev != null)
            {
                return(new ComplexValue(rev));
            }
            return((ComplexValue)value);
        }
Esempio n. 2
0
 public static RationalValue ConvertFrom(IntegerValue value)
 {
     return(new RationalValue(value));
 }
Esempio n. 3
0
 public bool Equals(IntegerValue other)
 {
     return(other != null && _numeratorValue == other.Value && _denominatorValue == 1);
 }
Esempio n. 4
0
 public RationalValue Power(IntegerValue op)
 {
     return(new RationalValue((long)Math.Round(Math.Pow(_numeratorValue, op.Value)), (long)Math.Round(Math.Pow(_denominatorValue, op.Value))));
 }
Esempio n. 5
0
 public RationalValue Divide(IntegerValue op)
 {
     return(new RationalValue(
                _numeratorValue,
                _denominatorValue * op.Value));
 }
Esempio n. 6
0
 public RationalValue(IntegerValue value)
 {
     _numeratorValue   = value.Value;
     _denominatorValue = 1;
 }
 public static ComplexValue ConvertFrom(IntegerValue value)
 {
     return(new ComplexValue(value));
 }
 public bool Equals(IntegerValue other)
 {
     return(other != null && _dataValue.IsReal && _dataValue.Real == other.ToDouble());
 }
 public ComplexValue(IntegerValue realValue)
 {
     _dataValue.Real = realValue.ToDouble();
 }
Esempio n. 10
0
 public bool Equals(IntegerValue other)
 {
     return(other != null && _dataValue == (double)other.Value);
 }
Esempio n. 11
0
 public RealValue(IntegerValue value)
 {
     _dataValue = (double)value.Value;
 }