Diff of /src/ov-mp.cc [20b5d7] .. [14981e]  Maximize  Restore

Switch to side-by-side view

--- a/src/ov-mp.cc
+++ b/src/ov-mp.cc
@@ -88,6 +88,37 @@
       mpfr_free_str(s);
     }
 }
+octave_value 
+octave_mp::oct_binop_proxy (const octave_base_value& a1, const octave_base_value& a2, 
+                            int (*func) (mpfr_ptr rop, mpfr_srcptr op1, mpfr_srcptr op2, mpfr_rnd_t rnd))
+{
+  const octave_mp *arg1, *arg2; 
+  octave_mp *retval;
+  octave_stdout << "first arg of type " << a1.static_type_id () << "\n";
+  octave_stdout << "second arg of type " << a2.static_type_id () << "\n";
+  if (a1.static_type_id() == octave_mp::static_type_id ())
+    { /* a1 has the right type */
+      arg1 = reinterpret_cast<const octave_mp*>(&a1);
+      retval = new octave_mp(static_cast<long unsigned int>(0), 
+                             arg1->prec, arg1->rnd);
+     
+      if (a2.static_type_id() == retval->static_type_id())
+        {
+          arg2 = reinterpret_cast<const octave_mp*>(&a2);
+        } else {
+        arg2 = new octave_mp(a2.double_value (), arg1->prec, 
+                             arg1->rnd);
+      }
+    }
+  else
+    {
+      arg2 = reinterpret_cast<const octave_mp*>(&a2);
+      arg1 = new octave_mp(a1.double_value (), arg2->prec, arg2->rnd);
+    }
+  (void) func(retval->scalar, arg1->scalar, arg2->scalar, arg1->rnd);
+  return octave_value (retval);
+}
+
 
 octave_value
 octave_mp::map (unary_mapper_t umap) const

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks