Index: gmpxx.h
===================================================================
RCS file: /home/cvsfiles/gmp42/gmpxx.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -p -2 -r1.4 -r1.5
*** gmpxx.h	8 Apr 2006 19:58:48 -0000	1.4
--- gmpxx.h	31 Oct 2006 10:40:59 -0000	1.5
*************** struct __gmp_cmp_function
*** 1278,1367 ****
  };
  
- struct __gmp_ternary_addmul // z = w + v * u
- {
-   static void eval(mpz_ptr z, mpz_srcptr w, mpz_srcptr v, mpz_srcptr u)
-   { mpz_set(z, w); mpz_addmul(z, v, u); }
- 
-   static void eval(mpz_ptr z, mpz_srcptr w, mpz_srcptr v, unsigned long int l)
-   { mpz_set(z, w); mpz_addmul_ui(z, v, l); }
-   static void eval(mpz_ptr z, mpz_srcptr w, unsigned long int l, mpz_srcptr v)
-   { mpz_set(z, w); mpz_addmul_ui(z, v, l); }
-   static void eval(mpz_ptr z, mpz_srcptr w, mpz_srcptr v, signed long int l)
-   {
-     mpz_set(z, w);
-     if (l >= 0)
-       mpz_addmul_ui(z, v, l);
-     else
-       mpz_submul_ui(z, v, -l);
-   }
-   static void eval(mpz_ptr z, mpz_srcptr w, signed long int l, mpz_srcptr v)
-   {
-     mpz_set(z, w);
-     if (l >= 0)
-       mpz_addmul_ui(z, v, l);
-     else
-       mpz_submul_ui(z, v, -l);
-   }
-   static void eval(mpz_ptr z, mpz_srcptr w, mpz_srcptr v, double d)
-   {
-     mpz_t temp;
-     mpz_init_set_d(temp, d);
-     mpz_set(z, w);
-     mpz_addmul(z, v, temp);
-     mpz_clear(temp);
-   }
-   static void eval(mpz_ptr z, mpz_srcptr w, double d, mpz_srcptr v)
-   {
-     mpz_t temp;
-     mpz_init_set_d(temp, d);
-     mpz_set(z, w);
-     mpz_addmul(z, temp, v);
-     mpz_clear(temp);
-   }
- };
- 
- struct __gmp_ternary_submul // z = w - v * u
- {
-   static void eval(mpz_ptr z, mpz_srcptr w, mpz_srcptr v, mpz_srcptr u)
-   { mpz_set(z, w); mpz_submul(z, v, u); }
- 
-   static void eval(mpz_ptr z, mpz_srcptr w, mpz_srcptr v, unsigned long int l)
-   { mpz_set(z, w); mpz_submul_ui(z, v, l); }
-   static void eval(mpz_ptr z, mpz_srcptr w, unsigned long int l, mpz_srcptr v)
-   { mpz_set(z, w); mpz_submul_ui(z, v, l); }
-   static void eval(mpz_ptr z, mpz_srcptr w, mpz_srcptr v, signed long int l)
-   {
-     mpz_set(z, w);
-     if (l >= 0)
-       mpz_submul_ui(z, v, l);
-     else
-       mpz_addmul_ui(z, v, -l);
-   }
-   static void eval(mpz_ptr z, mpz_srcptr w, signed long int l, mpz_srcptr v)
-   {
-     mpz_set(z, w);
-     if (l >= 0)
-       mpz_submul_ui(z, v, l);
-     else
-       mpz_addmul_ui(z, v, -l);
-   }
-   static void eval(mpz_ptr z, mpz_srcptr w, mpz_srcptr v, double d)
-   {
-     mpz_t temp;
-     mpz_init_set_d(temp, d);
-     mpz_set(z, w);
-     mpz_submul(z, v, temp);
-     mpz_clear(temp);
-   }
-   static void eval(mpz_ptr z, mpz_srcptr w, double d, mpz_srcptr v)
-   {
-     mpz_t temp;
-     mpz_init_set_d(temp, d);
-     mpz_set(z, w);
-     mpz_submul(z, temp, v);
-     mpz_clear(temp);
-   }
- };
- 
  struct __gmp_rand_function
  {
--- 1278,1281 ----
*************** __GMPZQ_DEFINE_EXPR(__gmp_binary_minus)
*** 2863,3277 ****
  
  
- /* Integer ternary expressions of the kind `a+b*c' or `a*b+c' can be
-    evaluated directly via mpz_addmul */
- 
- // a + b * c
- #define __GMP_DEFINE_TERNARY_EXPR(eval_fun1, eval_fun2, eval_both)          \
-                                                                             \
- template <>                                                                 \
- class __gmp_expr<mpz_t, __gmp_binary_expr<mpz_class, __gmp_expr             \
- <mpz_t, __gmp_binary_expr<mpz_class, mpz_class, eval_fun1> >, eval_fun2> >  \
- {                                                                           \
- private:                                                                    \
-   typedef mpz_class val1_type;                                              \
-   typedef __gmp_expr                                                        \
-     <mpz_t, __gmp_binary_expr<mpz_class, mpz_class, eval_fun1> > val2_type; \
-                                                                             \
-   __gmp_binary_expr<val1_type, val2_type, eval_fun2> expr;                  \
- public:                                                                     \
-   __gmp_expr(const val1_type &val1, const val2_type &val2)                  \
-     : expr(val1, val2) { }                                                  \
-   void eval(mpz_ptr z) const                                                \
-   { eval_both::eval                                                         \
-       (z, expr.val1.get_mpz_t(), expr.val2.get_val1().get_mpz_t(),          \
-        expr.val2.get_val2().get_mpz_t()); }                                 \
-   const val1_type & get_val1() const { return expr.val1; }                  \
-   const val2_type & get_val2() const { return expr.val2; }                  \
-   unsigned long int get_prec() const { return mpf_get_default_prec(); }     \
- };                                                                          \
-                                                                             \
- template <class T>                                                          \
- class __gmp_expr<mpz_t, __gmp_binary_expr<mpz_class, __gmp_expr             \
- <mpz_t, __gmp_binary_expr<mpz_class, T, eval_fun1> >, eval_fun2> >          \
- {                                                                           \
- private:                                                                    \
-   typedef mpz_class val1_type;                                              \
-   typedef __gmp_expr                                                        \
-     <mpz_t, __gmp_binary_expr<mpz_class, T, eval_fun1> > val2_type;         \
-                                                                             \
-   __gmp_binary_expr<val1_type, val2_type, eval_fun2> expr;                  \
- public:                                                                     \
-   __gmp_expr(const val1_type &val1, const val2_type &val2)                  \
-     : expr(val1, val2) { }                                                  \
-   void eval(mpz_ptr z) const                                                \
-   { eval_both::eval                                                         \
-       (z, expr.val1.get_mpz_t(), expr.val2.get_val1().get_mpz_t(),          \
-        expr.val2.get_val2()); }                                             \
-   const val1_type & get_val1() const { return expr.val1; }                  \
-   const val2_type & get_val2() const { return expr.val2; }                  \
-   unsigned long int get_prec() const { return mpf_get_default_prec(); }     \
- };                                                                          \
-                                                                             \
- template <class T>                                                          \
- class __gmp_expr<mpz_t, __gmp_binary_expr<mpz_class, __gmp_expr             \
- <mpz_t, __gmp_binary_expr<T, mpz_class, eval_fun1> >, eval_fun2> >          \
- {                                                                           \
- private:                                                                    \
-   typedef mpz_class val1_type;                                              \
-   typedef __gmp_expr                                                        \
-     <mpz_t, __gmp_binary_expr<T, mpz_class, eval_fun1> > val2_type;         \
-                                                                             \
-   __gmp_binary_expr<val1_type, val2_type, eval_fun2> expr;                  \
- public:                                                                     \
-   __gmp_expr(const val1_type &val1, const val2_type &val2)                  \
-     : expr(val1, val2) { }                                                  \
-   void eval(mpz_ptr z) const                                                \
-   { eval_both::eval                                                         \
-       (z, expr.val1.get_mpz_t(), expr.val2.get_val1(),                      \
-        expr.val2.get_val2().get_mpz_t()); }                                 \
-   const val1_type & get_val1() const { return expr.val1; }                  \
-   const val2_type & get_val2() const { return expr.val2; }                  \
-   unsigned long int get_prec() const { return mpf_get_default_prec(); }     \
- };                                                                          \
-                                                                             \
- template <class T>                                                          \
- class __gmp_expr<mpz_t, __gmp_binary_expr<mpz_class, __gmp_expr             \
- <mpz_t, __gmp_binary_expr<mpz_class, __gmp_expr<mpz_t, T>, eval_fun1> >,    \
-   eval_fun2> >                                                              \
- {                                                                           \
- private:                                                                    \
-   typedef mpz_class val1_type;                                              \
-   typedef __gmp_expr<mpz_t, __gmp_binary_expr                               \
-     <mpz_class, __gmp_expr<mpz_t, T>, eval_fun1> > val2_type;               \
-                                                                             \
-   __gmp_binary_expr<val1_type, val2_type, eval_fun2> expr;                  \
- public:                                                                     \
-   __gmp_expr(const val1_type &val1, const val2_type &val2)                  \
-     : expr(val1, val2) { }                                                  \
-   void eval(mpz_ptr z) const                                                \
-   {                                                                         \
-     mpz_class temp(expr.val2.get_val2());                                   \
-     eval_both::eval                                                         \
-       (z, expr.val1.get_mpz_t(), expr.val2.get_val1().get_mpz_t(),          \
-        temp.get_mpz_t());                                                   \
-   }                                                                         \
-   const val1_type & get_val1() const { return expr.val1; }                  \
-   const val2_type & get_val2() const { return expr.val2; }                  \
-   unsigned long int get_prec() const { return mpf_get_default_prec(); }     \
- };                                                                          \
-                                                                             \
- template <class T>                                                          \
- class __gmp_expr<mpz_t, __gmp_binary_expr<mpz_class, __gmp_expr             \
- <mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, T>, mpz_class, eval_fun1> >,    \
-   eval_fun2> >                                                              \
- {                                                                           \
- private:                                                                    \
-   typedef mpz_class val1_type;                                              \
-   typedef __gmp_expr<mpz_t, __gmp_binary_expr                               \
-     <__gmp_expr<mpz_t, T>, mpz_class, eval_fun1> > val2_type;               \
-                                                                             \
-   __gmp_binary_expr<val1_type, val2_type, eval_fun2> expr;                  \
- public:                                                                     \
-   __gmp_expr(const val1_type &val1, const val2_type &val2)                  \
-     : expr(val1, val2) { }                                                  \
-   void eval(mpz_ptr z) const                                                \
-   {                                                                         \
-     mpz_class temp(expr.val2.get_val1());                                   \
-     eval_both::eval(z, expr.val1.get_mpz_t(), temp.get_mpz_t(),             \
- 		    expr.val2.get_val2().get_mpz_t());                      \
-   }                                                                         \
-   const val1_type & get_val1() const { return expr.val1; }                  \
-   const val2_type & get_val2() const { return expr.val2; }                  \
-   unsigned long int get_prec() const { return mpf_get_default_prec(); }     \
- };                                                                          \
-                                                                             \
- template <class T, class U>                                                 \
- class __gmp_expr<mpz_t, __gmp_binary_expr<mpz_class, __gmp_expr             \
- <mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, T>, U, eval_fun1> >,            \
-   eval_fun2> >                                                              \
- {                                                                           \
- private:                                                                    \
-   typedef mpz_class val1_type;                                              \
-   typedef __gmp_expr<mpz_t, __gmp_binary_expr                               \
-     <__gmp_expr<mpz_t, T>, U, eval_fun1> > val2_type;                       \
-                                                                             \
-   __gmp_binary_expr<val1_type, val2_type, eval_fun2> expr;                  \
- public:                                                                     \
-   __gmp_expr(const val1_type &val1, const val2_type &val2)                  \
-     : expr(val1, val2) { }                                                  \
-   void eval(mpz_ptr z) const                                                \
-   {                                                                         \
-     mpz_class temp(expr.val2.get_val1());                                   \
-     eval_both::eval                                                         \
-       (z, expr.val1.get_mpz_t(), temp.get_mpz_t(), expr.val2.get_val2());   \
-   }                                                                         \
-   const val1_type & get_val1() const { return expr.val1; }                  \
-   const val2_type & get_val2() const { return expr.val2; }                  \
-   unsigned long int get_prec() const { return mpf_get_default_prec(); }     \
- };                                                                          \
-                                                                             \
- template <class T, class U>                                                 \
- class __gmp_expr<mpz_t, __gmp_binary_expr<mpz_class, __gmp_expr             \
- <mpz_t, __gmp_binary_expr<T, __gmp_expr<mpz_t, U>, eval_fun1> >,            \
-   eval_fun2> >                                                              \
- {                                                                           \
- private:                                                                    \
-   typedef mpz_class val1_type;                                              \
-   typedef __gmp_expr<mpz_t, __gmp_binary_expr                               \
-     <T, __gmp_expr<mpz_t, U>, eval_fun1> > val2_type;                       \
-                                                                             \
-   __gmp_binary_expr<val1_type, val2_type, eval_fun2> expr;                  \
- public:                                                                     \
-   __gmp_expr(const val1_type &val1, const val2_type &val2)                  \
-     : expr(val1, val2) { }                                                  \
-   void eval(mpz_ptr z) const                                                \
-   {                                                                         \
-     mpz_class temp(expr.val2.get_val2());                                   \
-     eval_both::eval                                                         \
-       (z, expr.val1.get_mpz_t(), expr.val2.get_val1(), temp.get_mpz_t());   \
-   }                                                                         \
-   const val1_type & get_val1() const { return expr.val1; }                  \
-   const val2_type & get_val2() const { return expr.val2; }                  \
-   unsigned long int get_prec() const { return mpf_get_default_prec(); }     \
- };                                                                          \
-                                                                             \
- template <class T, class U>                                                 \
- class __gmp_expr<mpz_t, __gmp_binary_expr<mpz_class, __gmp_expr             \
- <mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, T>, __gmp_expr<mpz_t, U>,       \
-   eval_fun1> >, eval_fun2> >                                                \
- {                                                                           \
- private:                                                                    \
-   typedef mpz_class val1_type;                                              \
-   typedef __gmp_expr<mpz_t, __gmp_binary_expr                               \
-     <__gmp_expr<mpz_t, T>, __gmp_expr<mpz_t, U>, eval_fun1> > val2_type;    \
-                                                                             \
-   __gmp_binary_expr<val1_type, val2_type, eval_fun2> expr;                  \
- public:                                                                     \
-   __gmp_expr(const val1_type &val1, const val2_type &val2)                  \
-     : expr(val1, val2) { }                                                  \
-   void eval(mpz_ptr z) const                                                \
-   {                                                                         \
-     mpz_class temp1(expr.val2.get_val1());                                  \
-     mpz_class temp2(expr.val2.get_val2());                                  \
-     eval_both::eval                                                         \
-       (z, expr.val1.get_mpz_t(), temp1.get_mpz_t(), temp2.get_mpz_t());     \
-   }                                                                         \
-   const val1_type & get_val1() const { return expr.val1; }                  \
-   const val2_type & get_val2() const { return expr.val2; }                  \
-   unsigned long int get_prec() const { return mpf_get_default_prec(); }     \
- };                                                                          \
-                                                                             \
- template <class T>                                                          \
- class __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, T>,             \
-   __gmp_expr<mpz_t, __gmp_binary_expr<mpz_class, mpz_class, eval_fun1> >,   \
-   eval_fun2> >                                                              \
- {                                                                           \
- private:                                                                    \
-   typedef __gmp_expr<mpz_t, T> val1_type;                                   \
-   typedef __gmp_expr                                                        \
-     <mpz_t, __gmp_binary_expr<mpz_class, mpz_class, eval_fun1> > val2_type; \
-                                                                             \
-   __gmp_binary_expr<val1_type, val2_type, eval_fun2> expr;                  \
- public:                                                                     \
-   __gmp_expr(const val1_type &val1, const val2_type &val2)                  \
-     : expr(val1, val2) { }                                                  \
-   void eval(mpz_ptr z) const                                                \
-   {                                                                         \
-     mpz_class temp(expr.val1);                                              \
-     eval_both::eval(z, temp.get_mpz_t(), expr.val2.get_val1().get_mpz_t(),  \
- 		    expr.val2.get_val2().get_mpz_t());                      \
-   }                                                                         \
-   const val1_type & get_val1() const { return expr.val1; }                  \
-   const val2_type & get_val2() const { return expr.val2; }                  \
-   unsigned long int get_prec() const { return mpf_get_default_prec(); }     \
- };                                                                          \
-                                                                             \
- template <class T, class U>                                                 \
- class __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, T>,             \
-   __gmp_expr<mpz_t, __gmp_binary_expr<mpz_class, U, eval_fun1> >,           \
-   eval_fun2> >                                                              \
- {                                                                           \
- private:                                                                    \
-   typedef __gmp_expr<mpz_t, T> val1_type;                                   \
-   typedef __gmp_expr                                                        \
-     <mpz_t, __gmp_binary_expr<mpz_class, U, eval_fun1> > val2_type;         \
-                                                                             \
-   __gmp_binary_expr<val1_type, val2_type, eval_fun2> expr;                  \
- public:                                                                     \
-   __gmp_expr(const val1_type &val1, const val2_type &val2)                  \
-     : expr(val1, val2) { }                                                  \
-   void eval(mpz_ptr z) const                                                \
-   {                                                                         \
-     mpz_class temp(expr.val1);                                              \
-     eval_both::eval(z, temp.get_mpz_t(), expr.val2.get_val1().get_mpz_t(),  \
- 		    expr.val2.get_val2());                                  \
-   }                                                                         \
-   const val1_type & get_val1() const { return expr.val1; }                  \
-   const val2_type & get_val2() const { return expr.val2; }                  \
-   unsigned long int get_prec() const { return mpf_get_default_prec(); }     \
- };                                                                          \
-                                                                             \
- template <class T, class U>                                                 \
- class __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, T>,             \
-   __gmp_expr<mpz_t, __gmp_binary_expr<U, mpz_class, eval_fun1> >,           \
-   eval_fun2> >                                                              \
- {                                                                           \
- private:                                                                    \
-   typedef __gmp_expr<mpz_t, T> val1_type;                                   \
-   typedef __gmp_expr                                                        \
-     <mpz_t, __gmp_binary_expr<U, mpz_class, eval_fun1> > val2_type;         \
-                                                                             \
-   __gmp_binary_expr<val1_type, val2_type, eval_fun2> expr;                  \
- public:                                                                     \
-   __gmp_expr(const val1_type &val1, const val2_type &val2)                  \
-     : expr(val1, val2) { }                                                  \
-   void eval(mpz_ptr z) const                                                \
-   {                                                                         \
-     mpz_class temp(expr.val1);                                              \
-     eval_both::eval(z, temp.get_mpz_t(), expr.val2.get_val1(),              \
- 		    expr.val2.get_val2().get_mpz_t());                      \
-   }                                                                         \
-   const val1_type & get_val1() const { return expr.val1; }                  \
-   const val2_type & get_val2() const { return expr.val2; }                  \
-   unsigned long int get_prec() const { return mpf_get_default_prec(); }     \
- };                                                                          \
-                                                                             \
- template <class T, class U>                                                 \
- class __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, T>,             \
-   __gmp_expr<mpz_t, __gmp_binary_expr<mpz_class, __gmp_expr<mpz_t, U>,      \
-   eval_fun1> >, eval_fun2> >                                                \
- {                                                                           \
- private:                                                                    \
-   typedef __gmp_expr<mpz_t, T> val1_type;                                   \
-   typedef __gmp_expr<mpz_t, __gmp_binary_expr                               \
-     <mpz_class, __gmp_expr<mpz_t, U>, eval_fun1> > val2_type;               \
-                                                                             \
-   __gmp_binary_expr<val1_type, val2_type, eval_fun2> expr;                  \
- public:                                                                     \
-   __gmp_expr(const val1_type &val1, const val2_type &val2)                  \
-     : expr(val1, val2) { }                                                  \
-   void eval(mpz_ptr z) const                                                \
-   {                                                                         \
-     mpz_class temp1(expr.val1);                                             \
-     mpz_class temp2(expr.val2.get_val2());                                  \
-     eval_both::eval                                                         \
-       (z, temp1.get_mpz_t(), expr.val2.get_val1().get_mpz_t(),              \
-        temp2.get_mpz_t());                                                  \
-   }                                                                         \
-   const val1_type & get_val1() const { return expr.val1; }                  \
-   const val2_type & get_val2() const { return expr.val2; }                  \
-   unsigned long int get_prec() const { return mpf_get_default_prec(); }     \
- };                                                                          \
-                                                                             \
- template <class T, class U>                                                 \
- class __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, T>,             \
-   __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, U>, mpz_class,      \
-   eval_fun1> >, eval_fun2> >                                                \
- {                                                                           \
- private:                                                                    \
-   typedef __gmp_expr<mpz_t, T> val1_type;                                   \
-   typedef __gmp_expr<mpz_t, __gmp_binary_expr                               \
-     <__gmp_expr<mpz_t, U>, mpz_class, eval_fun1> > val2_type;               \
-                                                                             \
-   __gmp_binary_expr<val1_type, val2_type, eval_fun2> expr;                  \
- public:                                                                     \
-   __gmp_expr(const val1_type &val1, const val2_type &val2)                  \
-     : expr(val1, val2) { }                                                  \
-   void eval(mpz_ptr z) const                                                \
-   {                                                                         \
-     mpz_class temp1(expr.val1);                                             \
-     mpz_class temp2(expr.val2.get_val1());                                  \
-     eval_both::eval(z, temp1.get_mpz_t(), temp2.get_mpz_t(),                \
- 		    expr.val2.get_val2().get_mpz_t());                      \
-   }                                                                         \
-   const val1_type & get_val1() const { return expr.val1; }                  \
-   const val2_type & get_val2() const { return expr.val2; }                  \
-   unsigned long int get_prec() const { return mpf_get_default_prec(); }     \
- };                                                                          \
-                                                                             \
- template <class T, class U, class V>                                        \
- class __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, T>,             \
-   __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, U>, V,              \
-   eval_fun1> >, eval_fun2> >                                                \
- {                                                                           \
- private:                                                                    \
-   typedef __gmp_expr<mpz_t, T> val1_type;                                   \
-   typedef __gmp_expr<mpz_t, __gmp_binary_expr                               \
-   <__gmp_expr<mpz_t, U>, V, eval_fun1> > val2_type;                         \
-                                                                             \
-   __gmp_binary_expr<val1_type, val2_type, eval_fun2> expr;                  \
- public:                                                                     \
-   __gmp_expr(const val1_type &val1, const val2_type &val2)                  \
-     : expr(val1, val2) { }                                                  \
-   void eval(mpz_ptr z) const                                                \
-   {                                                                         \
-     mpz_class temp1(expr.val1);                                             \
-     mpz_class temp2(expr.val2.get_val1());                                  \
-     eval_both::eval                                                         \
-       (z, temp1.get_mpz_t(), temp2.get_mpz_t(), expr.val2.get_val2());      \
-   }                                                                         \
-   const val1_type & get_val1() const { return expr.val1; }                  \
-   const val2_type & get_val2() const { return expr.val2; }                  \
-   unsigned long int get_prec() const { return mpf_get_default_prec(); }     \
- };                                                                          \
-                                                                             \
- template <class T, class U, class V>                                        \
- class __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, T>,             \
-   __gmp_expr<mpz_t, __gmp_binary_expr<U, __gmp_expr<mpz_t, V>,              \
-   eval_fun1> >, eval_fun2> >                                                \
- {                                                                           \
- private:                                                                    \
-   typedef __gmp_expr<mpz_t, T> val1_type;                                   \
-   typedef __gmp_expr<mpz_t, __gmp_binary_expr                               \
-     <U, __gmp_expr<mpz_t, V>, eval_fun1> > val2_type;                       \
-                                                                             \
-   __gmp_binary_expr<val1_type, val2_type, eval_fun2> expr;                  \
- public:                                                                     \
-   __gmp_expr(const val1_type &val1, const val2_type &val2)                  \
-     : expr(val1, val2) { }                                                  \
-   void eval(mpz_ptr z) const                                                \
-   {                                                                         \
-     mpz_class temp1(expr.val1);                                             \
-     mpz_class temp2(expr.val2.get_val2());                                  \
-     eval_both::eval                                                         \
-       (z, temp1.get_mpz_t(), expr.val2.get_val1(), temp2.get_mpz_t());      \
-   }                                                                         \
-   const val1_type & get_val1() const { return expr.val1; }                  \
-   const val2_type & get_val2() const { return expr.val2; }                  \
-   unsigned long int get_prec() const { return mpf_get_default_prec(); }     \
- };                                                                          \
-                                                                             \
- template <class T, class U, class V>                                        \
- class __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, T>,             \
-   __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, U>,                 \
-   __gmp_expr<mpz_t, V>, eval_fun1> >, eval_fun2> >                          \
- {                                                                           \
- private:                                                                    \
-   typedef __gmp_expr<mpz_t, T> val1_type;                                   \
-   typedef __gmp_expr<mpz_t, __gmp_binary_expr                               \
-   <__gmp_expr<mpz_t, U>, __gmp_expr<mpz_t, V>, eval_fun1> > val2_type;      \
-                                                                             \
-   __gmp_binary_expr<val1_type, val2_type, eval_fun2> expr;                  \
- public:                                                                     \
-   __gmp_expr(const val1_type &val1, const val2_type &val2)                  \
-     : expr(val1, val2) { }                                                  \
-   void eval(mpz_ptr z) const                                                \
-   {                                                                         \
-     mpz_class temp1(expr.val1);                                             \
-     mpz_class temp2(expr.val2.get_val1());                                  \
-     mpz_class temp3(expr.val2.get_val2());                                  \
-     eval_both::eval                                                         \
-       (z, temp1.get_mpz_t(), temp2.get_mpz_t(), temp3.get_mpz_t());         \
-   }                                                                         \
-   const val1_type & get_val1() const { return expr.val1; }                  \
-   const val2_type & get_val2() const { return expr.val2; }                  \
-   unsigned long int get_prec() const { return mpf_get_default_prec(); }     \
- };
- 
- 
- __GMP_DEFINE_TERNARY_EXPR(__gmp_binary_multiplies, __gmp_binary_plus,
- 			  __gmp_ternary_addmul)
- __GMP_DEFINE_TERNARY_EXPR(__gmp_binary_multiplies, __gmp_binary_minus,
- 			  __gmp_ternary_submul)
  
  /**************** Macros for defining functions ****************/
--- 2777,2780 ----
