Exemple #1
0
 public static object MakeRectangular(object obj1, object obj2)
 {
     if (IsExact(obj1) && IsExact(obj2))
     {
         var f = GetFraction(obj2);
         if (f == 0)
         {
             return(obj1);
         }
         return(ComplexFraction.Make(GetFraction(obj1), f));
     }
     else
     {
         double o2 = SafeConvert(obj2);
         if (o2 == 0.0)
         {
             o2 = 0; // get rid of negative 0
             if (!(obj2 is double))
             {
                 return(obj1);
             }
         }
         return(Complex64.Make(SafeConvert(obj1), o2));
     }
 }