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); }
public static RationalValue ConvertFrom(IntegerValue value) { return(new RationalValue(value)); }
public bool Equals(IntegerValue other) { return(other != null && _numeratorValue == other.Value && _denominatorValue == 1); }
public RationalValue Power(IntegerValue op) { return(new RationalValue((long)Math.Round(Math.Pow(_numeratorValue, op.Value)), (long)Math.Round(Math.Pow(_denominatorValue, op.Value)))); }
public RationalValue Divide(IntegerValue op) { return(new RationalValue( _numeratorValue, _denominatorValue * op.Value)); }
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(); }
public bool Equals(IntegerValue other) { return(other != null && _dataValue == (double)other.Value); }
public RealValue(IntegerValue value) { _dataValue = (double)value.Value; }