Example #1
0
 // 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);
 }
Example #2
0
 public static ComplexFraction Plus(ComplexFraction x)
 {
     return(+x);
 }
Example #3
0
 public static ComplexFraction Negate(ComplexFraction x)
 {
     return(-x);
 }
Example #4
0
 public static ComplexFraction Mod(ComplexFraction x, ComplexFraction y)
 {
     return(x % y);
 }
Example #5
0
 public static ComplexFraction Divide(ComplexFraction x, ComplexFraction y)
 {
     return(x / y);
 }
Example #6
0
 public static ComplexFraction Multiply(ComplexFraction x, ComplexFraction y)
 {
     return(x * y);
 }
Example #7
0
 public static ComplexFraction Subtract(ComplexFraction x, ComplexFraction y)
 {
     return(x - y);
 }
Example #8
0
 public static ComplexFraction Divide(ComplexFraction x, ComplexFraction y)
 {
     return x / y;
 }
Example #9
0
 public ComplexFractionConstant(ComplexFraction f)
 {
     value = f;
 }
Example #10
0
 public ComplexFraction Power(ComplexFraction y)
 {
     return ((Complex64)this).Power(y);
 }
Example #11
0
 public static ComplexFraction Subtract(ComplexFraction x, ComplexFraction y)
 {
     return x - y;
 }
Example #12
0
 public static ComplexFraction Plus(ComplexFraction x)
 {
     return +x;
 }
Example #13
0
 public static ComplexFraction Negate(ComplexFraction x)
 {
     return -x;
 }
Example #14
0
 public static ComplexFraction Multiply(ComplexFraction x, ComplexFraction y)
 {
     return x * y;
 }
Example #15
0
 public static ComplexFraction Mod(ComplexFraction x, ComplexFraction y)
 {
     return x % y;
 }
Example #16
0
 public ComplexFraction Power(ComplexFraction y)
 {
     return(((Complex64)this).Power(y));
 }
Example #17
0
 public static ComplexFraction Add(ComplexFraction x, ComplexFraction y)
 {
     return(x + y);
 }
Example #18
0
 public static ComplexFraction Add(ComplexFraction x, ComplexFraction y)
 {
     return x + y;
 }