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