Fixed initialization order bug (references to flyweights removed!) [C.Dams].
authorJens Vollinga <vollinga@thep.physik.uni-mainz.de>
Wed, 29 Jun 2005 18:09:24 +0000 (18:09 +0000)
committerJens Vollinga <vollinga@thep.physik.uni-mainz.de>
Wed, 29 Jun 2005 18:09:24 +0000 (18:09 +0000)
14 files changed:
ginac/add.cpp
ginac/inifcns.cpp
ginac/inifcns_gamma.cpp
ginac/inifcns_nstdsums.cpp
ginac/inifcns_trans.cpp
ginac/matrix.cpp
ginac/mul.cpp
ginac/normal.cpp
ginac/numeric.cpp
ginac/operators.cpp
ginac/power.cpp
ginac/relational.cpp
ginac/utils.cpp
ginac/utils.h

index a53a101..0ece092 100644 (file)
@@ -133,8 +133,8 @@ void add::print_add(const print_context & c, const char *openbrace, const char *
                        if (coeff.csgn() == -1) c.s << '-';
                        first = false;
                }
-               if (!coeff.is_equal(_num1) &&
-                   !coeff.is_equal(_num_1)) {
+               if (!coeff.is_equal(*_num1_p) &&
+                   !coeff.is_equal(*_num_1_p)) {
                        if (coeff.is_rational()) {
                                if (coeff.is_negative())
                                        (-coeff).print(c);
@@ -181,11 +181,11 @@ void add::do_print_csrc(const print_csrc & c, unsigned level) const
                } else if (it->coeff.is_equal(_ex_1)) {
                        c.s << "-";
                        it->rest.print(c, precedence());
-               } else if (ex_to<numeric>(it->coeff).numer().is_equal(_num1)) {
+               } else if (ex_to<numeric>(it->coeff).numer().is_equal(*_num1_p)) {
                        it->rest.print(c, precedence());
                        c.s << "/";
                        ex_to<numeric>(it->coeff).denom().print(c, precedence());
-               } else if (ex_to<numeric>(it->coeff).numer().is_equal(_num_1)) {
+               } else if (ex_to<numeric>(it->coeff).numer().is_equal(*_num_1_p)) {
                        c.s << "-";
                        it->rest.print(c, precedence());
                        c.s << "/";
@@ -200,7 +200,7 @@ void add::do_print_csrc(const print_csrc & c, unsigned level) const
                ++it;
                if (it != itend
                 && (is_a<print_csrc_cl_N>(c) || !it->coeff.info(info_flags::real)  // sign inside ctor arguments
-                 || !(it->coeff.info(info_flags::negative) || (it->coeff.is_equal(_num1) && is_exactly_a<numeric>(it->rest) && it->rest.info(info_flags::negative)))))
+                 || !(it->coeff.info(info_flags::negative) || (it->coeff.is_equal(*_num1_p) && is_exactly_a<numeric>(it->rest) && it->rest.info(info_flags::negative)))))
                        c.s << "+";
        }
        
@@ -531,7 +531,7 @@ expair add::combine_pair_with_coeff_to_pair(const expair & p,
        GINAC_ASSERT(is_exactly_a<numeric>(c));
 
        if (is_exactly_a<numeric>(p.rest)) {
-               GINAC_ASSERT(ex_to<numeric>(p.coeff).is_equal(_num1)); // should be normalized
+               GINAC_ASSERT(ex_to<numeric>(p.coeff).is_equal(*_num1_p)); // should be normalized
                return expair(ex_to<numeric>(p.rest).mul_dyn(ex_to<numeric>(c)),_ex1);
        }
 
@@ -540,7 +540,7 @@ expair add::combine_pair_with_coeff_to_pair(const expair & p,
        
 ex add::recombine_pair_to_ex(const expair & p) const
 {
-       if (ex_to<numeric>(p.coeff).is_equal(_num1))
+       if (ex_to<numeric>(p.coeff).is_equal(*_num1_p))
                return p.rest;
        else
                return (new mul(p.rest,p.coeff))->setflag(status_flags::dynallocated);
index c27aa98..ebb3846 100644 (file)
@@ -339,7 +339,7 @@ static ex Li2_series(const ex &x, const relational &rel, int order, unsigned opt
                        ex ser;
                        // manually construct the primitive expansion
                        for (int i=1; i<order; ++i)
-                               ser += pow(s,i) / pow(numeric(i), _num2);
+                               ser += pow(s,i) / pow(numeric(i), *_num2_p);
                        // substitute the argument's series expansion
                        ser = ser.subs(s==x.series(rel, order), subs_options::no_pattern);
                        // maybe that was terminating, so add a proper order term
@@ -503,14 +503,14 @@ static ex binomial_sym(const ex & x, const numeric & y)
        if (y.is_integer()) {
                if (y.is_nonneg_integer()) {
                        const unsigned N = y.to_int();
-                       if (N == 0) return _num0;
+                       if (N == 0) return _ex0;
                        if (N == 1) return x;
                        ex t = x.expand();
                        for (unsigned i = 2; i <= N; ++i)
                                t = (t * (x + i - y - 1)).expand() / i;
                        return t;
                } else
-                       return _num0;
+                       return _ex0;
        }
 
        return binomial(x, y).hold();
index 4a1e3c3..baed308 100644 (file)
@@ -142,11 +142,11 @@ static ex tgamma_eval(const ex & x)
 {
        if (x.info(info_flags::numeric)) {
                // trap integer arguments:
-               const numeric two_x = _num2*ex_to<numeric>(x);
+               const numeric two_x = (*_num2_p)*ex_to<numeric>(x);
                if (two_x.is_even()) {
                        // tgamma(n) -> (n-1)! for postitive n
                        if (two_x.is_positive()) {
-                               return factorial(ex_to<numeric>(x).sub(_num1));
+                               return factorial(ex_to<numeric>(x).sub(*_num1_p));
                        } else {
                                throw (pole_error("tgamma_eval(): simple pole",1));
                        }
@@ -156,13 +156,13 @@ static ex tgamma_eval(const ex & x)
                        // trap positive x==(n+1/2)
                        // tgamma(n+1/2) -> Pi^(1/2)*(1*3*..*(2*n-1))/(2^n)
                        if (two_x.is_positive()) {
-                               const numeric n = ex_to<numeric>(x).sub(_num1_2);
-                               return (doublefactorial(n.mul(_num2).sub(_num1)).div(pow(_num2,n))) * sqrt(Pi);
+                               const numeric n = ex_to<numeric>(x).sub(*_num1_2_p);
+                               return (doublefactorial(n.mul(*_num2_p).sub(*_num1_p)).div(pow(*_num2_p,n))) * sqrt(Pi);
                        } else {
                                // trap negative x==(-n+1/2)
                                // tgamma(-n+1/2) -> Pi^(1/2)*(-2)^n/(1*3*..*(2*n-1))
-                               const numeric n = abs(ex_to<numeric>(x).sub(_num1_2));
-                               return (pow(_num_2, n).div(doublefactorial(n.mul(_num2).sub(_num1))))*sqrt(Pi);
+                               const numeric n = abs(ex_to<numeric>(x).sub(*_num1_2_p));
+                               return (pow(*_num_2_p, n).div(doublefactorial(n.mul(*_num2_p).sub(*_num1_p))))*sqrt(Pi);
                        }
                }
                //  tgamma_evalf should be called here once it becomes available
@@ -245,13 +245,13 @@ static ex beta_eval(const ex & x, const ex & y)
                        ny.is_real() && ny.is_integer()) {
                        if (nx.is_negative()) {
                                if (nx<=-ny)
-                                       return pow(_num_1, ny)*beta(1-x-y, y);
+                                       return pow(*_num_1_p, ny)*beta(1-x-y, y);
                                else
                                        throw (pole_error("beta_eval(): simple pole",1));
                        }
                        if (ny.is_negative()) {
                                if (ny<=-nx)
-                                       return pow(_num_1, nx)*beta(1-y-x, x);
+                                       return pow(*_num_1_p, nx)*beta(1-y-x, x);
                                else
                                        throw (pole_error("beta_eval(): simple pole",1));
                        }
@@ -356,7 +356,7 @@ static ex psi1_eval(const ex & x)
                        if (nx.is_positive()) {
                                // psi(n) -> 1 + 1/2 +...+ 1/(n-1) - Euler
                                numeric rat = 0;
-                               for (numeric i(nx+_num_1); i>0; --i)
+                               for (numeric i(nx+(*_num_1_p)); i>0; --i)
                                        rat += i.inverse();
                                return rat-Euler;
                        } else {
@@ -364,13 +364,13 @@ static ex psi1_eval(const ex & x)
                                throw (pole_error("psi_eval(): simple pole",1));
                        }
                }
-               if ((_num2*nx).is_integer()) {
+               if (((*_num2_p)*nx).is_integer()) {
                        // half integer case
                        if (nx.is_positive()) {
                                // psi((2m+1)/2) -> 2/(2m+1) + 2/2m +...+ 2/1 - Euler - 2log(2)
                                numeric rat = 0;
-                               for (numeric i = (nx+_num_1)*_num2; i>0; i-=_num2)
-                                       rat += _num2*i.inverse();
+                               for (numeric i = (nx+(*_num_1_p))*(*_num2_p); i>0; i-=(*_num2_p))
+                                       rat += (*_num2_p)*i.inverse();
                                return rat-Euler-_ex2*log(_ex2);
                        } else {
                                // use the recurrence relation
@@ -380,7 +380,7 @@ static ex psi1_eval(const ex & x)
                                // where r == ((-1/2)^(-1) + ... + (-m-1/2)^(-1))
                                numeric recur = 0;
                                for (numeric p = nx; p<0; ++p)
-                                       recur -= pow(p, _num_1);
+                                       recur -= pow(p, *_num_1_p);
                                return recur+psi(_ex1_2);
                        }
                }
@@ -462,9 +462,9 @@ static ex psi2_eval(const ex & n, const ex & x)
                const numeric &nx = ex_to<numeric>(x);
                if (nx.is_integer()) {
                        // integer case 
-                       if (nx.is_equal(_num1))
+                       if (nx.is_equal(*_num1_p))
                                // use psi(n,1) == (-)^(n+1) * n! * zeta(n+1)
-                               return pow(_num_1,nn+_num1)*factorial(nn)*zeta(ex(nn+_num1));
+                               return pow(*_num_1_p,nn+(*_num1_p))*factorial(nn)*zeta(ex(nn+(*_num1_p)));
                        if (nx.is_positive()) {
                                // use the recurrence relation
                                //   psi(n,m) == psi(n,m+1) - (-)^n * n! / m^(n+1)
@@ -473,25 +473,25 @@ static ex psi2_eval(const ex & n, const ex & x)
                                // where r == (-)^n * n! * (1^(-n-1) + ... + (m-1)^(-n-1))
                                numeric recur = 0;
                                for (numeric p = 1; p<nx; ++p)
-                                       recur += pow(p, -nn+_num_1);
-                               recur *= factorial(nn)*pow(_num_1, nn);
+                                       recur += pow(p, -nn+(*_num_1_p));
+                               recur *= factorial(nn)*pow((*_num_1_p), nn);
                                return recur+psi(n,_ex1);
                        } else {
                                // for non-positive integers there is a pole:
                                throw (pole_error("psi2_eval(): pole",1));
                        }
                }
-               if ((_num2*nx).is_integer()) {
+               if (((*_num2_p)*nx).is_integer()) {
                        // half integer case
-                       if (nx.is_equal(_num1_2))
+                       if (nx.is_equal(*_num1_2_p))
                                // use psi(n,1/2) == (-)^(n+1) * n! * (2^(n+1)-1) * zeta(n+1)
-                               return pow(_num_1,nn+_num1)*factorial(nn)*(pow(_num2,nn+_num1) + _num_1)*zeta(ex(nn+_num1));
+                               return pow(*_num_1_p,nn+(*_num1_p))*factorial(nn)*(pow(*_num2_p,nn+(*_num1_p)) + (*_num_1_p))*zeta(ex(nn+(*_num1_p)));
                        if (nx.is_positive()) {
-                               const numeric m = nx - _num1_2;
+                               const numeric m = nx - (*_num1_2_p);
                                // use the multiplication formula
                                //   psi(n,2*m) == (psi(n,m) + psi(n,m+1/2)) / 2^(n+1)
                                // to revert to positive integer case
-                               return psi(n,_num2*m)*pow(_num2,nn+_num1)-psi(n,m);
+                               return psi(n,(*_num2_p)*m)*pow((*_num2_p),nn+(*_num1_p))-psi(n,m);
                        } else {
                                // use the recurrence relation
                                //   psi(n,-m-1/2) == psi(n,-m-1/2+1) - (-)^n * n! / (-m-1/2)^(n+1)
@@ -500,8 +500,8 @@ static ex psi2_eval(const ex & n, const ex & x)
                                // where r == (-)^(n+1) * n! * ((-1/2)^(-n-1) + ... + (-m-1/2)^(-n-1))
                                numeric recur = 0;
                                for (numeric p = nx; p<0; ++p)
-                                       recur += pow(p, -nn+_num_1);
-                               recur *= factorial(nn)*pow(_num_1, nn+_num_1);
+                                       recur += pow(p, -nn+(*_num_1_p));
+                               recur *= factorial(nn)*pow(*_num_1_p, nn+(*_num_1_p));
                                return recur+psi(n,_ex1_2);
                        }
                }
index 3d1f8bc..3920bf9 100644 (file)
@@ -3537,18 +3537,18 @@ static ex zeta1_eval(const ex& m)
                        if (y.is_zero()) {
                                return _ex_1_2;
                        }
-                       if (y.is_equal(_num1)) {
+                       if (y.is_equal(*_num1_p)) {
                                return zeta(m).hold();
                        }
                        if (y.info(info_flags::posint)) {
                                if (y.info(info_flags::odd)) {
                                        return zeta(m).hold();
                                } else {
-                                       return abs(bernoulli(y)) * pow(Pi, y) * pow(_num2, y-_num1) / factorial(y);
+                                       return abs(bernoulli(y)) * pow(Pi, y) * pow(*_num2_p, y-(*_num1_p)) / factorial(y);
                                }
                        } else {
                                if (y.info(info_flags::odd)) {
-                                       return -bernoulli(_num1-y) / (_num1-y);
+                                       return -bernoulli((*_num1_p)-y) / ((*_num1_p)-y);
                                } else {
                                        return _ex0;
                                }
index f737a9e..12c0d20 100644 (file)
@@ -59,14 +59,14 @@ static ex exp_eval(const ex & x)
        // exp(n*Pi*I/2) -> {+1|+I|-1|-I}
        const ex TwoExOverPiI=(_ex2*x)/(Pi*I);
        if (TwoExOverPiI.info(info_flags::integer)) {
-               const numeric z = mod(ex_to<numeric>(TwoExOverPiI),_num4);
-               if (z.is_equal(_num0))
+               const numeric z = mod(ex_to<numeric>(TwoExOverPiI),*_num4_p);
+               if (z.is_equal(*_num0_p))
                        return _ex1;
-               if (z.is_equal(_num1))
+               if (z.is_equal(*_num1_p))
                        return ex(I);
-               if (z.is_equal(_num2))
+               if (z.is_equal(*_num2_p))
                        return _ex_1;
-               if (z.is_equal(_num3))
+               if (z.is_equal(*_num3_p))
                        return ex(-I);
        }
 
@@ -116,9 +116,9 @@ static ex log_eval(const ex & x)
                if (x.is_equal(_ex1))  // log(1) -> 0
                        return _ex0;
                if (x.is_equal(I))       // log(I) -> Pi*I/2
-                       return (Pi*I*_num1_2);
+                       return (Pi*I*_ex1_2);
                if (x.is_equal(-I))      // log(-I) -> -Pi*I/2
-                       return (Pi*I*_num_1_2);
+                       return (Pi*I*_ex_1_2);
 
                // log(float) -> float
                if (!x.info(info_flags::crational))
@@ -262,33 +262,33 @@ static ex sin_eval(const ex & x)
        const ex SixtyExOverPi = _ex60*x/Pi;
        ex sign = _ex1;
        if (SixtyExOverPi.info(info_flags::integer)) {
-               numeric z = mod(ex_to<numeric>(SixtyExOverPi),_num120);
-               if (z>=_num60) {
+               numeric z = mod(ex_to<numeric>(SixtyExOverPi),*_num120_p);
+               if (z>=*_num60_p) {
                        // wrap to interval [0, Pi)
-                       z -= _num60;
+                       z -= *_num60_p;
                        sign = _ex_1;
                }
-               if (z>_num30) {
+               if (z>*_num30_p) {
                        // wrap to interval [0, Pi/2)
-                       z = _num60-z;
+                       z = *_num60_p-z;
                }
-               if (z.is_equal(_num0))  // sin(0)       -> 0
+               if (z.is_equal(*_num0_p))  // sin(0)       -> 0
                        return _ex0;
-               if (z.is_equal(_num5))  // sin(Pi/12)   -> sqrt(6)/4*(1-sqrt(3)/3)
+               if (z.is_equal(*_num5_p))  // sin(Pi/12)   -> sqrt(6)/4*(1-sqrt(3)/3)
                        return sign*_ex1_4*sqrt(_ex6)*(_ex1+_ex_1_3*sqrt(_ex3));
-               if (z.is_equal(_num6))  // sin(Pi/10)   -> sqrt(5)/4-1/4
+               if (z.is_equal(*_num6_p))  // sin(Pi/10)   -> sqrt(5)/4-1/4
                        return sign*(_ex1_4*sqrt(_ex5)+_ex_1_4);
-               if (z.is_equal(_num10)) // sin(Pi/6)    -> 1/2
+               if (z.is_equal(*_num10_p)) // sin(Pi/6)    -> 1/2
                        return sign*_ex1_2;
-               if (z.is_equal(_num15)) // sin(Pi/4)    -> sqrt(2)/2
+               if (z.is_equal(*_num15_p)) // sin(Pi/4)    -> sqrt(2)/2
                        return sign*_ex1_2*sqrt(_ex2);
-               if (z.is_equal(_num18)) // sin(3/10*Pi) -> sqrt(5)/4+1/4
+               if (z.is_equal(*_num18_p)) // sin(3/10*Pi) -> sqrt(5)/4+1/4
                        return sign*(_ex1_4*sqrt(_ex5)+_ex1_4);
-               if (z.is_equal(_num20)) // sin(Pi/3)    -> sqrt(3)/2
+               if (z.is_equal(*_num20_p)) // sin(Pi/3)    -> sqrt(3)/2
                        return sign*_ex1_2*sqrt(_ex3);
-               if (z.is_equal(_num25)) // sin(5/12*Pi) -> sqrt(6)/4*(1+sqrt(3)/3)
+               if (z.is_equal(*_num25_p)) // sin(5/12*Pi) -> sqrt(6)/4*(1+sqrt(3)/3)
                        return sign*_ex1_4*sqrt(_ex6)*(_ex1+_ex1_3*sqrt(_ex3));
-               if (z.is_equal(_num30)) // sin(Pi/2)    -> 1
+               if (z.is_equal(*_num30_p)) // sin(Pi/2)    -> 1
                        return sign;
        }
 
@@ -350,33 +350,33 @@ static ex cos_eval(const ex & x)
        const ex SixtyExOverPi = _ex60*x/Pi;
        ex sign = _ex1;
        if (SixtyExOverPi.info(info_flags::integer)) {
-               numeric z = mod(ex_to<numeric>(SixtyExOverPi),_num120);
-               if (z>=_num60) {
+               numeric z = mod(ex_to<numeric>(SixtyExOverPi),*_num120_p);
+               if (z>=*_num60_p) {
                        // wrap to interval [0, Pi)
-                       z = _num120-z;
+                       z = *_num120_p-z;
                }
-               if (z>=_num30) {
+               if (z>=*_num30_p) {
                        // wrap to interval [0, Pi/2)
-                       z = _num60-z;
+                       z = *_num60_p-z;
                        sign = _ex_1;
                }
-               if (z.is_equal(_num0))  // cos(0)       -> 1
+               if (z.is_equal(*_num0_p))  // cos(0)       -> 1
                        return sign;
-               if (z.is_equal(_num5))  // cos(Pi/12)   -> sqrt(6)/4*(1+sqrt(3)/3)
+               if (z.is_equal(*_num5_p))  // cos(Pi/12)   -> sqrt(6)/4*(1+sqrt(3)/3)
                        return sign*_ex1_4*sqrt(_ex6)*(_ex1+_ex1_3*sqrt(_ex3));
-               if (z.is_equal(_num10)) // cos(Pi/6)    -> sqrt(3)/2
+               if (z.is_equal(*_num10_p)) // cos(Pi/6)    -> sqrt(3)/2
                        return sign*_ex1_2*sqrt(_ex3);
-               if (z.is_equal(_num12)) // cos(Pi/5)    -> sqrt(5)/4+1/4
+               if (z.is_equal(*_num12_p)) // cos(Pi/5)    -> sqrt(5)/4+1/4
                        return sign*(_ex1_4*sqrt(_ex5)+_ex1_4);
-               if (z.is_equal(_num15)) // cos(Pi/4)    -> sqrt(2)/2
+               if (z.is_equal(*_num15_p)) // cos(Pi/4)    -> sqrt(2)/2
                        return sign*_ex1_2*sqrt(_ex2);
-               if (z.is_equal(_num20)) // cos(Pi/3)    -> 1/2
+               if (z.is_equal(*_num20_p)) // cos(Pi/3)    -> 1/2
                        return sign*_ex1_2;
-               if (z.is_equal(_num24)) // cos(2/5*Pi)  -> sqrt(5)/4-1/4x
+               if (z.is_equal(*_num24_p)) // cos(2/5*Pi)  -> sqrt(5)/4-1/4x
                        return sign*(_ex1_4*sqrt(_ex5)+_ex_1_4);
-               if (z.is_equal(_num25)) // cos(5/12*Pi) -> sqrt(6)/4*(1-sqrt(3)/3)
+               if (z.is_equal(*_num25_p)) // cos(5/12*Pi) -> sqrt(6)/4*(1-sqrt(3)/3)
                        return sign*_ex1_4*sqrt(_ex6)*(_ex1+_ex_1_3*sqrt(_ex3));
-               if (z.is_equal(_num30)) // cos(Pi/2)    -> 0
+               if (z.is_equal(*_num30_p)) // cos(Pi/2)    -> 0
                        return _ex0;
        }
 
@@ -438,29 +438,29 @@ static ex tan_eval(const ex & x)
        const ex SixtyExOverPi = _ex60*x/Pi;
        ex sign = _ex1;
        if (SixtyExOverPi.info(info_flags::integer)) {
-               numeric z = mod(ex_to<numeric>(SixtyExOverPi),_num60);
-               if (z>=_num60) {
+               numeric z = mod(ex_to<numeric>(SixtyExOverPi),*_num60_p);
+               if (z>=*_num60_p) {
                        // wrap to interval [0, Pi)
-                       z -= _num60;
+                       z -= *_num60_p;
                }
-               if (z>=_num30) {
+               if (z>=*_num30_p) {
                        // wrap to interval [0, Pi/2)
-                       z = _num60-z;
+                       z = *_num60_p-z;
                        sign = _ex_1;
                }
-               if (z.is_equal(_num0))  // tan(0)       -> 0
+               if (z.is_equal(*_num0_p))  // tan(0)       -> 0
                        return _ex0;
-               if (z.is_equal(_num5))  // tan(Pi/12)   -> 2-sqrt(3)
+               if (z.is_equal(*_num5_p))  // tan(Pi/12)   -> 2-sqrt(3)
                        return sign*(_ex2-sqrt(_ex3));
-               if (z.is_equal(_num10)) // tan(Pi/6)    -> sqrt(3)/3
+               if (z.is_equal(*_num10_p)) // tan(Pi/6)    -> sqrt(3)/3
                        return sign*_ex1_3*sqrt(_ex3);
-               if (z.is_equal(_num15)) // tan(Pi/4)    -> 1
+               if (z.is_equal(*_num15_p)) // tan(Pi/4)    -> 1
                        return sign;
-               if (z.is_equal(_num20)) // tan(Pi/3)    -> sqrt(3)
+               if (z.is_equal(*_num20_p)) // tan(Pi/3)    -> sqrt(3)
                        return sign*sqrt(_ex3);
-               if (z.is_equal(_num25)) // tan(5/12*Pi) -> 2+sqrt(3)
+               if (z.is_equal(*_num25_p)) // tan(5/12*Pi) -> 2+sqrt(3)
                        return sign*(sqrt(_ex3)+_ex2);
-               if (z.is_equal(_num30)) // tan(Pi/2)    -> infinity
+               if (z.is_equal(*_num30_p)) // tan(Pi/2)    -> infinity
                        throw (pole_error("tan_eval(): simple pole",1));
        }
 
@@ -548,7 +548,7 @@ static ex asin_eval(const ex & x)
 
                // asin(1) -> Pi/2
                if (x.is_equal(_ex1))
-                       return _num1_2*Pi;
+                       return _ex1_2*Pi;
 
                // asin(-1/2) -> -Pi/6
                if (x.is_equal(_ex_1_2))
@@ -556,7 +556,7 @@ static ex asin_eval(const ex & x)
 
                // asin(-1) -> -Pi/2
                if (x.is_equal(_ex_1))
-                       return _num_1_2*Pi;
+                       return _ex_1_2*Pi;
 
                // asin(float) -> float
                if (!x.info(info_flags::crational))
index a4d789a..3cc2003 100644 (file)
@@ -647,12 +647,12 @@ matrix matrix::pow(const ex & expn) const
                        // that this is not entirely optimal but close to optimal and
                        // "better" algorithms are much harder to implement.  (See Knuth,
                        // TAoCP2, section "Evaluation of Powers" for a good discussion.)
-                       while (b!=_num1) {
+                       while (b!=*_num1_p) {
                                if (b.is_odd()) {
                                        C = C.mul(A);
                                        --b;
                                }
-                               b /= _num2;  // still integer.
+                               b /= *_num2_p;  // still integer.
                                A = A.mul(A);
                        }
                        return A.mul(C);
index fea5b34..b12f5d4 100644 (file)
@@ -129,8 +129,8 @@ void mul::print_overall_coeff(const print_context & c, const char *mul_sym) cons
        const numeric &coeff = ex_to<numeric>(overall_coeff);
        if (coeff.csgn() == -1)
                c.s << '-';
-       if (!coeff.is_equal(_num1) &&
-               !coeff.is_equal(_num_1)) {
+       if (!coeff.is_equal(*_num1_p) &&
+               !coeff.is_equal(*_num_1_p)) {
                if (coeff.is_rational()) {
                        if (coeff.is_negative())
                                (-coeff).print(c);
@@ -422,7 +422,7 @@ ex mul::eval(int level) const
                return recombine_pair_to_ex(*(seq.begin()));
        } else if ((seq_size==1) &&
                   is_exactly_a<add>((*seq.begin()).rest) &&
-                  ex_to<numeric>((*seq.begin()).coeff).is_equal(_num1)) {
+                  ex_to<numeric>((*seq.begin()).coeff).is_equal(*_num1_p)) {
                // *(+(x,y,...);c) -> +(*(x,c),*(y,c),...) (c numeric(), no powers of +())
                const add & addref = ex_to<add>((*seq.begin()).rest);
                std::auto_ptr<epvector> distrseq(new epvector);
@@ -767,7 +767,7 @@ expair mul::combine_pair_with_coeff_to_pair(const expair & p,
        
 ex mul::recombine_pair_to_ex(const expair & p) const
 {
-       if (ex_to<numeric>(p.coeff).is_equal(_num1)) 
+       if (ex_to<numeric>(p.coeff).is_equal(*_num1_p)) 
                return p.rest;
        else
                return (new power(p.rest,p.coeff))->setflag(status_flags::dynallocated);
@@ -822,7 +822,7 @@ bool mul::can_make_flat(const expair & p) const
        // this assertion will probably fail somewhere
        // it would require a more careful make_flat, obeying the power laws
        // probably should return true only if p.coeff is integer
-       return ex_to<numeric>(p.coeff).is_equal(_num1);
+       return ex_to<numeric>(p.coeff).is_equal(*_num1_p);
 }
 
 bool mul::can_be_further_expanded(const ex & e)
index 1808bcb..64c34ac 100644 (file)
@@ -233,14 +233,14 @@ static numeric lcmcoeff(const ex &e, const numeric &l)
        if (e.info(info_flags::rational))
                return lcm(ex_to<numeric>(e).denom(), l);
        else if (is_exactly_a<add>(e)) {
-               numeric c = _num1;
+               numeric c = *_num1_p;
                for (size_t i=0; i<e.nops(); i++)
                        c = lcmcoeff(e.op(i), c);
                return lcm(c, l);
        } else if (is_exactly_a<mul>(e)) {
-               numeric c = _num1;
+               numeric c = *_num1_p;
                for (size_t i=0; i<e.nops(); i++)
-                       c *= lcmcoeff(e.op(i), _num1);
+                       c *= lcmcoeff(e.op(i), *_num1_p);
                return lcm(c, l);
        } else if (is_exactly_a<power>(e)) {
                if (is_a<symbol>(e.op(0)))
@@ -260,7 +260,7 @@ static numeric lcmcoeff(const ex &e, const numeric &l)
  *  @return LCM of denominators of coefficients */
 static numeric lcm_of_coefficients_denominators(const ex &e)
 {
-       return lcmcoeff(e, _num1);
+       return lcmcoeff(e, *_num1_p);
 }
 
 /** Bring polynomial from Q[X] to Z[X] by multiplying in the previously
@@ -273,9 +273,9 @@ static ex multiply_lcm(const ex &e, const numeric &lcm)
        if (is_exactly_a<mul>(e)) {
                size_t num = e.nops();
                exvector v; v.reserve(num + 1);
-               numeric lcm_accum = _num1;
+               numeric lcm_accum = *_num1_p;
                for (size_t i=0; i<num; i++) {
-                       numeric op_lcm = lcmcoeff(e.op(i), _num1);
+                       numeric op_lcm = lcmcoeff(e.op(i), *_num1_p);
                        v.push_back(multiply_lcm(e.op(i), op_lcm));
                        lcm_accum *= op_lcm;
                }
@@ -310,7 +310,7 @@ numeric ex::integer_content() const
 
 numeric basic::integer_content() const
 {
-       return _num1;
+       return *_num1_p;
 }
 
 numeric numeric::integer_content() const
@@ -322,7 +322,7 @@ numeric add::integer_content() const
 {
        epvector::const_iterator it = seq.begin();
        epvector::const_iterator itend = seq.end();
-       numeric c = _num0, l = _num1;
+       numeric c = *_num0_p, l = *_num1_p;
        while (it != itend) {
                GINAC_ASSERT(!is_exactly_a<numeric>(it->rest));
                GINAC_ASSERT(is_exactly_a<numeric>(it->coeff));
@@ -730,24 +730,24 @@ static bool divide_in_z(const ex &a, const ex &b, ex &q, sym_desc_vec::const_ite
        // Compute values at evaluation points 0..adeg
        vector<numeric> alpha; alpha.reserve(adeg + 1);
        exvector u; u.reserve(adeg + 1);
-       numeric point = _num0;
+       numeric point = *_num0_p;
        ex c;
        for (i=0; i<=adeg; i++) {
                ex bs = b.subs(x == point, subs_options::no_pattern);
                while (bs.is_zero()) {
-                       point += _num1;
+                       point += *_num1_p;
                        bs = b.subs(x == point, subs_options::no_pattern);
                }
                if (!divide_in_z(a.subs(x == point, subs_options::no_pattern), bs, c, var+1))
                        return false;
                alpha.push_back(point);
                u.push_back(c);
-               point += _num1;
+               point += *_num1_p;
        }
 
        // Compute inverses
        vector<numeric> rcp; rcp.reserve(adeg + 1);
-       rcp.push_back(_num0);
+       rcp.push_back(*_num0_p);
        for (k=1; k<=adeg; k++) {
                numeric product = alpha[k] - alpha[0];
                for (i=1; i<k; i++)
@@ -1062,7 +1062,7 @@ numeric ex::max_coefficient() const
  *  @see heur_gcd */
 numeric basic::max_coefficient() const
 {
-       return _num1;
+       return *_num1_p;
 }
 
 numeric numeric::max_coefficient() const
@@ -1222,9 +1222,9 @@ static ex heur_gcd(const ex &a, const ex &b, ex *ca, ex *cb, sym_desc_vec::const
        numeric mq = q.max_coefficient();
        numeric xi;
        if (mp > mq)
-               xi = mq * _num2 + _num2;
+               xi = mq * (*_num2_p) + (*_num2_p);
        else
-               xi = mp * _num2 + _num2;
+               xi = mp * (*_num2_p) + (*_num2_p);
 
        // 6 tries maximum
        for (int t=0; t<6; t++) {
@@ -1898,7 +1898,7 @@ static ex frac_cancel(const ex &n, const ex &d)
 {
        ex num = n;
        ex den = d;
-       numeric pre_factor = _num1;
+       numeric pre_factor = *_num1_p;
 
 //std::clog << "frac_cancel num = " << num << ", den = " << den << std::endl;
 
index 59d61ab..963bc74 100644 (file)
@@ -238,6 +238,7 @@ numeric::numeric(const cln::cl_N &z) : basic(TINFO_numeric)
        setflag(status_flags::evaluated | status_flags::expanded);
 }
 
+
 //////////
 // archiving
 //////////
@@ -760,7 +761,7 @@ const numeric numeric::power(const numeric &other) const
 {
        // Shortcut for efficiency and numeric stability (as in 1.0 exponent):
        // trap the neutral exponent.
-       if (&other==_num1_p || cln::equal(other.value,_num1.value))
+       if (&other==_num1_p || cln::equal(other.value,_num1_p->value))
                return *this;
        
        if (cln::zerop(value)) {
@@ -771,7 +772,7 @@ const numeric numeric::power(const numeric &other) const
                else if (cln::minusp(cln::realpart(other.value)))
                        throw std::overflow_error("numeric::eval(): division by zero");
                else
-                       return _num0;
+                       return *_num0_p;
        }
        return numeric(cln::expt(value, other.value));
 }
@@ -857,7 +858,7 @@ const numeric &numeric::power_dyn(const numeric &other) const
        // Efficiency shortcut: trap the neutral exponent (first try by pointer, then
        // try harder, since calls to cln::expt() below may return amazing results for
        // floating point exponent 1.0).
-       if (&other==_num1_p || cln::equal(other.value, _num1.value))
+       if (&other==_num1_p || cln::equal(other.value, _num1_p->value))
                return *this;
        
        if (cln::zerop(value)) {
@@ -868,7 +869,7 @@ const numeric &numeric::power_dyn(const numeric &other) const
                else if (cln::minusp(cln::realpart(other.value)))
                        throw std::overflow_error("numeric::eval(): division by zero");
                else
-                       return _num0;
+                       return *_num0_p;
        }
        return static_cast<const numeric &>((new numeric(cln::expt(value, other.value)))->
                                             setflag(status_flags::dynallocated));
@@ -1237,7 +1238,7 @@ const numeric numeric::numer() const
 const numeric numeric::denom() const
 {
        if (cln::instanceof(value, cln::cl_I_ring))
-               return _num1;  // integer case
+               return *_num1_p;  // integer case
        
        if (cln::instanceof(value, cln::cl_RA_ring))
                return numeric(cln::denominator(cln::the<cln::cl_RA>(value)));
@@ -1246,7 +1247,7 @@ const numeric numeric::denom() const
                const cln::cl_RA r = cln::the<cln::cl_RA>(cln::realpart(value));
                const cln::cl_RA i = cln::the<cln::cl_RA>(cln::imagpart(value));
                if (cln::instanceof(r, cln::cl_I_ring) && cln::instanceof(i, cln::cl_I_ring))
-                       return _num1;
+                       return *_num1_p;
                if (cln::instanceof(r, cln::cl_I_ring) && cln::instanceof(i, cln::cl_RA_ring))
                        return numeric(cln::denominator(i));
                if (cln::instanceof(r, cln::cl_RA_ring) && cln::instanceof(i, cln::cl_I_ring))
@@ -1255,7 +1256,7 @@ const numeric numeric::denom() const
                        return numeric(cln::lcm(cln::denominator(r), cln::denominator(i)));
        }
        // at least one float encountered
-       return _num1;
+       return *_num1_p;
 }
 
 
@@ -1359,7 +1360,7 @@ const numeric atan(const numeric &x)
 {
        if (!x.is_real() &&
            x.real().is_zero() &&
-           abs(x.imag()).is_equal(_num1))
+           abs(x.imag()).is_equal(*_num1_p))
                throw pole_error("atan(): logarithmic pole",0);
        return cln::atan(x.to_cl_N());
 }
@@ -1510,7 +1511,7 @@ static cln::cl_N Li2_projection(const cln::cl_N &x,
 const numeric Li2(const numeric &x)
 {
        if (x.is_zero())
-               return _num0;
+               return *_num0_p;
        
        // what is the desired float format?
        // first guess: default format
@@ -1601,8 +1602,8 @@ const numeric factorial(const numeric &n)
  *  @exception range_error (argument must be integer >= -1) */
 const numeric doublefactorial(const numeric &n)
 {
-       if (n.is_equal(_num_1))
-               return _num1;
+       if (n.is_equal(*_num_1_p))
+               return *_num1_p;
        
        if (!n.is_nonneg_integer())
                throw std::range_error("numeric::doublefactorial(): argument must be integer >= -1");
@@ -1619,12 +1620,12 @@ const numeric binomial(const numeric &n, const numeric &k)
 {
        if (n.is_integer() && k.is_integer()) {
                if (n.is_nonneg_integer()) {
-                       if (k.compare(n)!=1 && k.compare(_num0)!=-1)
+                       if (k.compare(n)!=1 && k.compare(*_num0_p)!=-1)
                                return numeric(cln::binomial(n.to_int(),k.to_int()));
                        else
-                               return _num0;
+                               return *_num0_p;
                } else {
-                       return _num_1.power(k)*binomial(k-n-_num1,k);
+                       return _num_1_p->power(k)*binomial(k-n-(*_num1_p),k);
                }
        }
        
@@ -1681,9 +1682,9 @@ const numeric bernoulli(const numeric &nn)
 
        // the special cases not covered by the algorithm below
        if (n & 1)
-               return (n==1) ? _num_1_2 : _num0;
+               return (n==1) ? (*_num_1_2_p) : (*_num0_p);
        if (!n)
-               return _num1;
+               return *_num1_p;
 
        // store nonvanishing Bernoulli numbers here
        static std::vector< cln::cl_RA > results;
@@ -1751,7 +1752,7 @@ const numeric fibonacci(const numeric &n)
        // hence
        //      F(2n+2) = F(n+1)*(2*F(n) + F(n+1))
        if (n.is_zero())
-               return _num0;
+               return *_num0_p;
        if (n.is_negative())
                if (n.is_even())
                        return -fibonacci(-n);
@@ -1803,7 +1804,7 @@ const numeric mod(const numeric &a, const numeric &b)
                return cln::mod(cln::the<cln::cl_I>(a.to_cl_N()),
                                cln::the<cln::cl_I>(b.to_cl_N()));
        else
-               return _num0;
+               return *_num0_p;
 }
 
 
@@ -1818,7 +1819,7 @@ const numeric smod(const numeric &a, const numeric &b)
                return cln::mod(cln::the<cln::cl_I>(a.to_cl_N()) + b2,
                                cln::the<cln::cl_I>(b.to_cl_N())) - b2;
        } else
-               return _num0;
+               return *_num0_p;
 }
 
 
@@ -1837,7 +1838,7 @@ const numeric irem(const numeric &a, const numeric &b)
                return cln::rem(cln::the<cln::cl_I>(a.to_cl_N()),
                                cln::the<cln::cl_I>(b.to_cl_N()));
        else
-               return _num0;
+               return *_num0_p;
 }
 
 
@@ -1859,8 +1860,8 @@ const numeric irem(const numeric &a, const numeric &b, numeric &q)
                q = rem_quo.quotient;
                return rem_quo.remainder;
        } else {
-               q = _num0;
-               return _num0;
+               q = *_num0_p;
+               return *_num0_p;
        }
 }
 
@@ -1878,7 +1879,7 @@ const numeric iquo(const numeric &a, const numeric &b)
                return cln::truncate1(cln::the<cln::cl_I>(a.to_cl_N()),
                                  cln::the<cln::cl_I>(b.to_cl_N()));
        else
-               return _num0;
+               return *_num0_p;
 }
 
 
@@ -1899,8 +1900,8 @@ const numeric iquo(const numeric &a, const numeric &b, numeric &r)
                r = rem_quo.remainder;
                return rem_quo.quotient;
        } else {
-               r = _num0;
-               return _num0;
+               r = *_num0_p;
+               return *_num0_p;
        }
 }
 
@@ -1915,7 +1916,7 @@ const numeric gcd(const numeric &a, const numeric &b)
                return cln::gcd(cln::the<cln::cl_I>(a.to_cl_N()),
                                cln::the<cln::cl_I>(b.to_cl_N()));
        else
-               return _num1;
+               return *_num1_p;
 }
 
 
@@ -1955,7 +1956,7 @@ const numeric isqrt(const numeric &x)
                cln::isqrt(cln::the<cln::cl_I>(x.to_cl_N()), &root);
                return root;
        } else
-               return _num0;
+               return *_num0_p;
 }
 
 
index e92dac9..2b68206 100644 (file)
@@ -175,7 +175,7 @@ const numeric operator+(const numeric & lh)
 
 const numeric operator-(const numeric & lh)
 {
-       return _num_1.mul(lh);
+       return _num_1_p->mul(lh);
 }
 
 
@@ -214,14 +214,14 @@ const ex operator--(ex & lh, int)
 /** Numeric prefix increment.  Adds 1 and returns incremented number. */
 numeric& operator++(numeric & rh)
 {
-       rh = rh.add(_num1);
+       rh = rh.add(*_num1_p);
        return rh;
 }
 
 /** Numeric prefix decrement.  Subtracts 1 and returns decremented number. */
 numeric& operator--(numeric & rh)
 {
-       rh = rh.add(_num_1);
+       rh = rh.add(*_num_1_p);
        return rh;
 }
 
@@ -230,7 +230,7 @@ numeric& operator--(numeric & rh)
 const numeric operator++(numeric & lh, int)
 {
        numeric tmp(lh);
-       lh = lh.add(_num1);
+       lh = lh.add(*_num1_p);
        return tmp;
 }
 
@@ -239,7 +239,7 @@ const numeric operator++(numeric & lh, int)
 const numeric operator--(numeric & lh, int)
 {
        numeric tmp(lh);
-       lh = lh.add(_num_1);
+       lh = lh.add(*_num_1_p);
        return tmp;
 }
 
index 7929768..815c593 100644 (file)
@@ -448,7 +448,7 @@ ex power::eval(int level) const
                        if (is_exactly_a<numeric>(sub_exponent)) {
                                const numeric & num_sub_exponent = ex_to<numeric>(sub_exponent);
                                GINAC_ASSERT(num_sub_exponent!=numeric(1));
-                               if (num_exponent->is_integer() || (abs(num_sub_exponent) - _num1).is_negative())
+                               if (num_exponent->is_integer() || (abs(num_sub_exponent) - (*_num1_p)).is_negative())
                                        return power(sub_basis,num_sub_exponent.mul(*num_exponent));
                        }
                }
@@ -474,8 +474,8 @@ ex power::eval(int level) const
                                                return (new mul(power(*mulp,exponent),
                                                                power(num_coeff,*num_exponent)))->setflag(status_flags::dynallocated);
                                        } else {
-                                               GINAC_ASSERT(num_coeff.compare(_num0)<0);
-                                               if (!num_coeff.is_equal(_num_1)) {
+                                               GINAC_ASSERT(num_coeff.compare(*_num0_p)<0);
+                                               if (!num_coeff.is_equal(*_num_1_p)) {
                                                        mul *mulp = new mul(mulref);
                                                        mulp->overall_coeff = _ex_1;
                                                        mulp->clearflag(status_flags::evaluated);
@@ -806,7 +806,7 @@ ex power::expand_add_2(const add & a, unsigned options) const
                
                if (c.is_equal(_ex1)) {
                        if (is_exactly_a<mul>(r)) {
-                               sum.push_back(expair(expand_mul(ex_to<mul>(r), _num2, options, true),
+                               sum.push_back(expair(expand_mul(ex_to<mul>(r), *_num2_p, options, true),
                                                     _ex1));
                        } else {
                                sum.push_back(expair((new power(r,_ex2))->setflag(status_flags::dynallocated),
@@ -814,11 +814,11 @@ ex power::expand_add_2(const add & a, unsigned options) const
                        }
                } else {
                        if (is_exactly_a<mul>(r)) {
-                               sum.push_back(a.combine_ex_with_coeff_to_pair(expand_mul(ex_to<mul>(r), _num2, options, true),
-                                                    ex_to<numeric>(c).power_dyn(_num2)));
+                               sum.push_back(a.combine_ex_with_coeff_to_pair(expand_mul(ex_to<mul>(r), *_num2_p, options, true),
+                                                    ex_to<numeric>(c).power_dyn(*_num2_p)));
                        } else {
                                sum.push_back(a.combine_ex_with_coeff_to_pair((new power(r,_ex2))->setflag(status_flags::dynallocated),
-                                                    ex_to<numeric>(c).power_dyn(_num2)));
+                                                    ex_to<numeric>(c).power_dyn(*_num2_p)));
                        }
                }
 
@@ -826,7 +826,7 @@ ex power::expand_add_2(const add & a, unsigned options) const
                        const ex & r1 = cit1->rest;
                        const ex & c1 = cit1->coeff;
                        sum.push_back(a.combine_ex_with_coeff_to_pair((new mul(r,r1))->setflag(status_flags::dynallocated),
-                                                                     _num2.mul(ex_to<numeric>(c)).mul_dyn(ex_to<numeric>(c1))));
+                                                                     _num2_p->mul(ex_to<numeric>(c)).mul_dyn(ex_to<numeric>(c1))));
                }
        }
        
@@ -836,10 +836,10 @@ ex power::expand_add_2(const add & a, unsigned options) const
        if (!a.overall_coeff.is_zero()) {
                epvector::const_iterator i = a.seq.begin(), end = a.seq.end();
                while (i != end) {
-                       sum.push_back(a.combine_pair_with_coeff_to_pair(*i, ex_to<numeric>(a.overall_coeff).mul_dyn(_num2)));
+                       sum.push_back(a.combine_pair_with_coeff_to_pair(*i, ex_to<numeric>(a.overall_coeff).mul_dyn(*_num2_p)));
                        ++i;
                }
-               sum.push_back(expair(ex_to<numeric>(a.overall_coeff).power_dyn(_num2),_ex1));
+               sum.push_back(expair(ex_to<numeric>(a.overall_coeff).power_dyn(*_num2_p),_ex1));
        }
        
        GINAC_ASSERT(sum.size()==(a_nops*(a_nops+1))/2);
index d2b3880..247b75f 100644 (file)
@@ -338,13 +338,13 @@ relational::operator relational::safe_bool() const
                case not_equal:
                        return make_safe_bool(!ex_to<numeric>(df).is_zero());
                case less:
-                       return make_safe_bool(ex_to<numeric>(df)<_num0);
+                       return make_safe_bool(ex_to<numeric>(df)<(*_num0_p));
                case less_or_equal:
-                       return make_safe_bool(ex_to<numeric>(df)<=_num0);
+                       return make_safe_bool(ex_to<numeric>(df)<=(*_num0_p));
                case greater:
-                       return make_safe_bool(ex_to<numeric>(df)>_num0);
+                       return make_safe_bool(ex_to<numeric>(df)>(*_num0_p));
                case greater_or_equal:
-                       return make_safe_bool(ex_to<numeric>(df)>=_num0);
+                       return make_safe_bool(ex_to<numeric>(df)>=(*_num0_p));
                default:
                        throw(std::logic_error("invalid relational operator"));
        }
index 6b86740..07c0a1f 100644 (file)
@@ -64,249 +64,200 @@ int library_init::count = 0;
 
 // static numeric -120
 const numeric *_num_120_p;
-const numeric &_num_120 = *_num_120_p;
-const ex _ex_120 = _num_120;
+const ex _ex_120 = _ex_120;
 
 // static numeric -60
 const numeric *_num_60_p;
-const numeric &_num_60 = *_num_60_p;
-const ex _ex_60 = _num_60;
+const ex _ex_60 = _ex_60;
 
 // static numeric -48
 const numeric *_num_48_p;
-const numeric &_num_48 = *_num_48_p;
-const ex _ex_48 = _num_48;
+const ex _ex_48 = _ex_48;
 
 // static numeric -30
 const numeric *_num_30_p;
-const numeric &_num_30 = *_num_30_p;
-const ex _ex_30 = _num_30;
+const ex _ex_30 = _ex_30;
 
 // static numeric -25
 const numeric *_num_25_p;
-const numeric &_num_25 = *_num_25_p;
-const ex _ex_25 = _num_25;
+const ex _ex_25 = _ex_25;
 
 // static numeric -24
 const numeric *_num_24_p;
-const numeric &_num_24 = *_num_24_p;
-const ex _ex_24 = _num_24;
+const ex _ex_24 = _ex_24;
 
 // static numeric -20
 const numeric *_num_20_p;
-const numeric &_num_20 = *_num_20_p;
-const ex _ex_20 = _num_20;
+const ex _ex_20 = _ex_20;
 
 // static numeric -18
 const numeric *_num_18_p;
-const numeric &_num_18 = *_num_18_p;
-const ex _ex_18 = _num_18;
+const ex _ex_18 = _ex_18;
 
 // static numeric -15
 const numeric *_num_15_p;
-const numeric &_num_15 = *_num_15_p;
-const ex _ex_15 = _num_15;
+const ex _ex_15 = _ex_15;
 
 // static numeric -12
 const numeric *_num_12_p;
-const numeric &_num_12 = *_num_12_p;
-const ex _ex_12 = _num_12;
+const ex _ex_12 = _ex_12;
 
 // static numeric -11
 const numeric *_num_11_p;
-const numeric &_num_11 = *_num_11_p;
-const ex _ex_11 = _num_11;
+const ex _ex_11 = _ex_11;
 
 // static numeric -10
 const numeric *_num_10_p;
-const numeric &_num_10 = *_num_10_p;
-const ex _ex_10 = _num_10;
+const ex _ex_10 = _ex_10;
 
 // static numeric -9
 const numeric *_num_9_p;
-const numeric &_num_9 = *_num_9_p;
-const ex _ex_9 = _num_9;
+const ex _ex_9 = _ex_9;
 
 // static numeric -8
 const numeric *_num_8_p;
-const numeric &_num_8 = *_num_8_p;
-const ex _ex_8 = _num_8;
+const ex _ex_8 = _ex_8;
 
 // static numeric -7
 const numeric *_num_7_p;
-const numeric &_num_7 = *_num_7_p;
-const ex _ex_7 = _num_7;
+const ex _ex_7 = _ex_7;
 
 // static numeric -6
 const numeric *_num_6_p;
-const numeric &_num_6 = *_num_6_p;
-const ex _ex_6 = _num_6;
+const ex _ex_6 = _ex_6;
 
 // static numeric -5
 const numeric *_num_5_p;
-const numeric &_num_5 = *_num_5_p;
-const ex _ex_5 = _num_5;
+const ex _ex_5 = _ex_5;
 
 // static numeric -4
 const numeric *_num_4_p;
-const numeric &_num_4 = *_num_4_p;
-const ex _ex_4 = _num_4;
+const ex _ex_4 = _ex_4;
 
 // static numeric -3
 const numeric *_num_3_p;
-const numeric &_num_3 = *_num_3_p;
-const ex _ex_3 = _num_3;
+const ex _ex_3 = _ex_3;
 
 // static numeric -2
 const numeric *_num_2_p;
-const numeric &_num_2 = *_num_2_p;
-const ex _ex_2 = _num_2;
+const ex _ex_2 = _ex_2;
 
 // static numeric -1
 const numeric *_num_1_p;
-const numeric &_num_1 = *_num_1_p;
-const ex _ex_1 = _num_1;
+const ex _ex_1 = _ex_1;
 
 // static numeric -1/2
 const numeric *_num_1_2_p;
-const numeric &_num_1_2= *_num_1_2_p;
-const ex _ex_1_2= _num_1_2;
+const ex _ex_1_2= _ex_1_2;
 
 // static numeric -1/3
 const numeric *_num_1_3_p;
-const numeric &_num_1_3= *_num_1_3_p;
-const ex _ex_1_3= _num_1_3;
+const ex _ex_1_3= _ex_1_3;
 
 // static numeric -1/4
 const numeric *_num_1_4_p;
-const numeric &_num_1_4= *_num_1_4_p;
-const ex _ex_1_4= _num_1_4;
+const ex _ex_1_4= _ex_1_4;
 
 // static numeric 0
 const numeric *_num0_p;
 const basic *_num0_bp;
-const numeric &_num0 = *_num0_p;
-const ex _ex0 = _num0;
+const ex _ex0 = _ex0;
 
 // static numeric 1/4
 const numeric *_num1_4_p;
-const numeric &_num1_4 = *_num1_4_p;
-const ex _ex1_4 = _num1_4;
+const ex _ex1_4 = _ex1_4;
 
 // static numeric 1/3
 const numeric *_num1_3_p;
-const numeric &_num1_3 = *_num1_3_p;
-const ex _ex1_3 = _num1_3;
+const ex _ex1_3 = _ex1_3;
 
 // static numeric 1/2
 const numeric *_num1_2_p;
-const numeric &_num1_2 = *_num1_2_p;
-const ex _ex1_2 = _num1_2;
+const ex _ex1_2 = _ex1_2;
 
 // static numeric 1
 const numeric *_num1_p;
-const numeric &_num1 = *_num1_p;
-const ex _ex1 = _num1;
+const ex _ex1 = _ex1;
 
 // static numeric 2
 const numeric *_num2_p;
-const numeric &_num2 = *_num2_p;
-const ex _ex2 = _num2;
+const ex _ex2 = _ex2;
 
 // static numeric 3
 const numeric *_num3_p;
-const numeric &_num3 = *_num3_p;
-const ex _ex3 = _num3;
+const ex _ex3 = _ex3;
 
 // static numeric 4
 const numeric *_num4_p;
-const numeric &_num4 = *_num4_p;
-const ex _ex4 = _num4;
+const ex _ex4 = _ex4;
 
 // static numeric 5
 const numeric *_num5_p;
-const numeric &_num5 = *_num5_p;
-const ex _ex5 = _num5;
+const ex _ex5 = _ex5;
 
 // static numeric 6
 const numeric *_num6_p;
-const numeric &_num6 = *_num6_p;
-const ex _ex6 = _num6;
+const ex _ex6 = _ex6;
 
 // static numeric 7
 const numeric *_num7_p;
-const numeric &_num7 = *_num7_p;
-const ex _ex7 = _num7;
+const ex _ex7 = _ex7;
 
 // static numeric 8
 const numeric *_num8_p;
-const numeric &_num8 = *_num8_p;
-const ex _ex8 = _num8;
+const ex _ex8 = _ex8;
 
 // static numeric 9
 const numeric *_num9_p;
-const numeric &_num9 = *_num9_p;
-const ex _ex9 = _num9;
+const ex _ex9 = _ex9;
 
 // static numeric 10
 const numeric *_num10_p;
-const numeric &_num10 = *_num10_p;
-const ex _ex10 = _num10;
+const ex _ex10 = _ex10;
 
 // static numeric 11
 const numeric *_num11_p;
-const numeric &_num11 = *_num11_p;
-const ex _ex11 = _num11;
+const ex _ex11 = _ex11;
 
 // static numeric 12
 const numeric *_num12_p;
-const numeric &_num12 = *_num12_p;
-const ex _ex12 = _num12;
+const ex _ex12 = _ex12;
 
 // static numeric 15
 const numeric *_num15_p;
-const numeric &_num15 = *_num15_p;
-const ex _ex15 = _num15;
+const ex _ex15 = _ex15;
 
 // static numeric 18
 const numeric *_num18_p;
-const numeric &_num18 = *_num18_p;
-const ex _ex18 = _num18;
+const ex _ex18 = _ex18;
 
 // static numeric 20
 const numeric *_num20_p;
-const numeric &_num20 = *_num20_p;
-const ex _ex20 = _num20;
+const ex _ex20 = _ex20;
 
 // static numeric 24
 const numeric *_num24_p;
-const numeric &_num24 = *_num24_p;
-const ex _ex24 = _num24;
+const ex _ex24 = _ex24;
 
 // static numeric 25
 const numeric *_num25_p;
-const numeric &_num25 = *_num25_p;
-const ex _ex25 = _num25;
+const ex _ex25 = _ex25;
 
 // static numeric 30
 const numeric *_num30_p;
-const numeric &_num30 = *_num30_p;
-const ex _ex30 = _num30;
+const ex _ex30 = _ex30;
 
 // static numeric 48
 const numeric *_num48_p;
-const numeric &_num48 = *_num48_p;
-const ex _ex48 = _num48;
+const ex _ex48 = _ex48;
 
 // static numeric 60
 const numeric *_num60_p;
-const numeric &_num60 = *_num60_p;
-const ex _ex60 = _num60;
+const ex _ex60 = _ex60;
 
 // static numeric 120
 const numeric *_num120_p;
-const numeric &_num120 = *_num120_p;
-const ex _ex120 = _num120;
+const ex _ex120 = _ex120;
 
 /** Ctor of static initialization helpers.  The fist call to this is going
  *  to initialize the library, the others do nothing. */
@@ -364,6 +315,56 @@ library_init::library_init()
                (_num60_p = new numeric(60))->setflag(status_flags::dynallocated);
                (_num120_p = new numeric(120))->setflag(status_flags::dynallocated);
 
+               new((void*)&_ex_120) ex(*_num_120_p);
+               new((void*)&_ex_60) ex(*_num_60_p);
+               new((void*)&_ex_48) ex(*_num_48_p);
+               new((void*)&_ex_30) ex(*_num_30_p);
+               new((void*)&_ex_25) ex(*_num_25_p);
+               new((void*)&_ex_24) ex(*_num_24_p);
+               new((void*)&_ex_20) ex(*_num_20_p);
+               new((void*)&_ex_18) ex(*_num_18_p);
+               new((void*)&_ex_15) ex(*_num_15_p);
+               new((void*)&_ex_12) ex(*_num_12_p);
+               new((void*)&_ex_11) ex(*_num_11_p);
+               new((void*)&_ex_10) ex(*_num_10_p);
+               new((void*)&_ex_9) ex(*_num_9_p);
+               new((void*)&_ex_8) ex(*_num_8_p);
+               new((void*)&_ex_7) ex(*_num_7_p);
+               new((void*)&_ex_6) ex(*_num_6_p);
+               new((void*)&_ex_5) ex(*_num_5_p);
+               new((void*)&_ex_4) ex(*_num_4_p);
+               new((void*)&_ex_3) ex(*_num_3_p);
+               new((void*)&_ex_2) ex(*_num_2_p);
+               new((void*)&_ex_1) ex(*_num_1_p);
+               new((void*)&_ex_1_2) ex(*_num_1_2_p);
+               new((void*)&_ex_1_3) ex(*_num_1_3_p);
+               new((void*)&_ex_1_4) ex(*_num_1_4_p);
+               new((void*)&_ex0) ex(*_num0_p);
+               new((void*)&_ex1_4) ex(*_num1_4_p);
+               new((void*)&_ex1_3) ex(*_num1_3_p);
+               new((void*)&_ex1_2) ex(*_num1_2_p);
+               new((void*)&_ex1) ex(*_num1_p);
+               new((void*)&_ex2) ex(*_num2_p);
+               new((void*)&_ex3) ex(*_num3_p);
+               new((void*)&_ex4) ex(*_num4_p);
+               new((void*)&_ex5) ex(*_num5_p);
+               new((void*)&_ex6) ex(*_num6_p);
+               new((void*)&_ex7) ex(*_num7_p);
+               new((void*)&_ex8) ex(*_num8_p);
+               new((void*)&_ex9) ex(*_num9_p);
+               new((void*)&_ex10) ex(*_num10_p);
+               new((void*)&_ex11) ex(*_num11_p);
+               new((void*)&_ex12) ex(*_num12_p);
+               new((void*)&_ex15) ex(*_num15_p);
+               new((void*)&_ex18) ex(*_num18_p);
+               new((void*)&_ex20) ex(*_num20_p);
+               new((void*)&_ex24) ex(*_num24_p);
+               new((void*)&_ex25) ex(*_num25_p);
+               new((void*)&_ex30) ex(*_num30_p);
+               new((void*)&_ex48) ex(*_num48_p);
+               new((void*)&_ex60) ex(*_num60_p);
+               new((void*)&_ex120) ex(*_num120_p);
+
                // Initialize print context class info (this is not strictly necessary
                // but we do it anyway to make print_context_class_info::dump_hierarchy()
                // output the whole hierarchy whether or not the classes are actually
index 3db08b2..ae17f53 100644 (file)
@@ -288,152 +288,103 @@ again:
 class ex;
 
 extern const numeric *_num_120_p;
-extern const numeric &_num_120;
 extern const ex _ex_120;
 extern const numeric *_num_60_p;
-extern const numeric &_num_60;
 extern const ex _ex_60;
 extern const numeric *_num_48_p;
-extern const numeric &_num_48;
 extern const ex _ex_48;
 extern const numeric *_num_30_p;
-extern const numeric &_num_30;
 extern const ex _ex_30;
 extern const numeric *_num_25_p;
-extern const numeric &_num_25;
 extern const ex _ex_25;
 extern const numeric *_num_24_p;
-extern const numeric &_num_24;
 extern const ex _ex_24;
 extern const numeric *_num_20_p;
-extern const numeric &_num_20;
 extern const ex _ex_20;
 extern const numeric *_num_18_p;
-extern const numeric &_num_18;
 extern const ex _ex_18;
 extern const numeric *_num_15_p;
-extern const numeric &_num_15;
 extern const ex _ex_15;
 extern const numeric *_num_12_p;
-extern const numeric &_num_12;
 extern const ex _ex_12;
 extern const numeric *_num_11_p;
-extern const numeric &_num_11;
 extern const ex _ex_11;
 extern const numeric *_num_10_p;
-extern const numeric &_num_10;
 extern const ex _ex_10;
 extern const numeric *_num_9_p;
-extern const numeric &_num_9;
 extern const ex _ex_9;
 extern const numeric *_num_8_p;
-extern const numeric &_num_8;
 extern const ex _ex_8;
 extern const numeric *_num_7_p;
-extern const numeric &_num_7;
 extern const ex _ex_7;
 extern const numeric *_num_6_p;
-extern const numeric &_num_6;
 extern const ex _ex_6;
 extern const numeric *_num_5_p;
-extern const numeric &_num_5;
 extern const ex _ex_5;
 extern const numeric *_num_4_p;
-extern const numeric &_num_4;
 extern const ex _ex_4;
 extern const numeric *_num_3_p;
-extern const numeric &_num_3;
 extern const ex _ex_3;
 extern const numeric *_num_2_p;
-extern const numeric &_num_2;
 extern const ex _ex_2;
 extern const numeric *_num_1_p;
-extern const numeric &_num_1;
 extern const ex _ex_1;
 extern const numeric *_num_1_2_p;
-extern const numeric &_num_1_2;
 extern const ex _ex_1_2;
 extern const numeric *_num_1_3_p;
-extern const numeric &_num_1_3;
 extern const ex _ex_1_3;
 extern const numeric *_num_1_4_p;
-extern const numeric &_num_1_4;
 extern const ex _ex_1_4;
 extern const numeric *_num0_p;
 extern const basic *_num0_bp;
-extern const numeric &_num0;
 extern const ex _ex0;
 extern const numeric *_num1_4_p;
-extern const numeric &_num1_4;
 extern const ex _ex1_4;
 extern const numeric *_num1_3_p;
-extern const numeric &_num1_3;
 extern const ex _ex1_3;
 extern const numeric *_num1_2_p;
-extern const numeric &_num1_2;
 extern const ex _ex1_2;
 extern const numeric *_num1_p;
-extern const numeric &_num1;
 extern const ex _ex1;
 extern const numeric *_num2_p;
-extern const numeric &_num2;
 extern const ex _ex2;
 extern const numeric *_num3_p;
-extern const numeric &_num3;
 extern const ex _ex3;
 extern const numeric *_num4_p;
-extern const numeric &_num4;
 extern const ex _ex4;
 extern const numeric *_num5_p;
-extern const numeric &_num5;
 extern const ex _ex5;
 extern const numeric *_num6_p;
-extern const numeric &_num6;
 extern const ex _ex6;
 extern const numeric *_num7_p;
-extern const numeric &_num7;
 extern const ex _ex7;
 extern const numeric *_num8_p;
-extern const numeric &_num8;
 extern const ex _ex8;
 extern const numeric *_num9_p;
-extern const numeric &_num9;
 extern const ex _ex9;
 extern const numeric *_num10_p;
-extern const numeric &_num10;
 extern const ex _ex10;
 extern const numeric *_num11_p;
-extern const numeric &_num11;
 extern const ex _ex11;
 extern const numeric *_num12_p;
-extern const numeric &_num12;
 extern const ex _ex12;
 extern const numeric *_num15_p;
-extern const numeric &_num15;
 extern const ex _ex15;
 extern const numeric *_num18_p;
-extern const numeric &_num18;
 extern const ex _ex18;
 extern const numeric *_num20_p;
-extern const numeric &_num20;
 extern const ex _ex20;
 extern const numeric *_num24_p;
-extern const numeric &_num24;
 extern const ex _ex24;
 extern const numeric *_num25_p;
-extern const numeric &_num25;
 extern const ex _ex25;
 extern const numeric *_num30_p;
-extern const numeric &_num30;
 extern const ex _ex30;
 extern const numeric *_num48_p;
-extern const numeric &_num48;
 extern const ex _ex48;
 extern const numeric *_num60_p;
-extern const numeric &_num60;
 extern const ex _ex60;
 extern const numeric *_num120_p;
-extern const numeric &_num120;
 extern const ex _ex120;