// improve actually static object IntegerIfPossible(object res) { if (res is BigInteger) { return(ToIntegerIfPossible((BigInteger)res)); } else if (res is Fraction) { Fraction f = (Fraction)res; if (f.Denominator == 1) { return(ToIntegerIfPossible(f.Numerator)); } } else if (res is ComplexFraction) { ComplexFraction cf = (ComplexFraction)res; if (cf.Imag == 0) { return(IntegerIfPossible(cf.Real)); } } return(res); }
public static ComplexFraction Plus(ComplexFraction x) { return(+x); }
public static ComplexFraction Negate(ComplexFraction x) { return(-x); }
public static ComplexFraction Mod(ComplexFraction x, ComplexFraction y) { return(x % y); }
public static ComplexFraction Divide(ComplexFraction x, ComplexFraction y) { return(x / y); }
public static ComplexFraction Multiply(ComplexFraction x, ComplexFraction y) { return(x * y); }
public static ComplexFraction Subtract(ComplexFraction x, ComplexFraction y) { return(x - y); }
public static ComplexFraction Divide(ComplexFraction x, ComplexFraction y) { return x / y; }
public ComplexFractionConstant(ComplexFraction f) { value = f; }
public ComplexFraction Power(ComplexFraction y) { return ((Complex64)this).Power(y); }
public static ComplexFraction Subtract(ComplexFraction x, ComplexFraction y) { return x - y; }
public static ComplexFraction Plus(ComplexFraction x) { return +x; }
public static ComplexFraction Negate(ComplexFraction x) { return -x; }
public static ComplexFraction Multiply(ComplexFraction x, ComplexFraction y) { return x * y; }
public static ComplexFraction Mod(ComplexFraction x, ComplexFraction y) { return x % y; }
public ComplexFraction Power(ComplexFraction y) { return(((Complex64)this).Power(y)); }
public static ComplexFraction Add(ComplexFraction x, ComplexFraction y) { return(x + y); }
public static ComplexFraction Add(ComplexFraction x, ComplexFraction y) { return x + y; }