Exemple #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);
 }
Exemple #2
0
 public static ComplexFraction Plus(ComplexFraction x)
 {
     return(+x);
 }
Exemple #3
0
 public static ComplexFraction Negate(ComplexFraction x)
 {
     return(-x);
 }
Exemple #4
0
 public static ComplexFraction Mod(ComplexFraction x, ComplexFraction y)
 {
     return(x % y);
 }
Exemple #5
0
 public static ComplexFraction Divide(ComplexFraction x, ComplexFraction y)
 {
     return(x / y);
 }
Exemple #6
0
 public static ComplexFraction Multiply(ComplexFraction x, ComplexFraction y)
 {
     return(x * y);
 }
Exemple #7
0
 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;
 }
Exemple #16
0
 public ComplexFraction Power(ComplexFraction y)
 {
     return(((Complex64)this).Power(y));
 }
Exemple #17
0
 public static ComplexFraction Add(ComplexFraction x, ComplexFraction y)
 {
     return(x + y);
 }
 public static ComplexFraction Add(ComplexFraction x, ComplexFraction y)
 {
     return x + y;
 }