X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Fnumeric.cpp;h=c86369fbe000cc2f885dac04a19ddcddb9c56394;hp=795c76099172dba5d5284fd6fc08c4183428fc3d;hb=dfaba64cff32f7dfdd96c1a96d1744ce6c1d80ad;hpb=f282e2b3a3873619006b6ffd3fa7fe65010c1299 diff --git a/ginac/numeric.cpp b/ginac/numeric.cpp index 795c7609..c86369fb 100644 --- a/ginac/numeric.cpp +++ b/ginac/numeric.cpp @@ -7,7 +7,7 @@ * of special functions or implement the interface to the bignum package. */ /* - * GiNaC Copyright (C) 1999-2011 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2015 Johannes Gutenberg University Mainz, Germany * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -32,7 +32,6 @@ #include "ex.h" #include "operators.h" #include "archive.h" -#include "tostring.h" #include "utils.h" #include @@ -225,7 +224,7 @@ numeric::numeric(const char *s) // E to lower case term = term.replace(term.find("E"),1,"e"); // append _ to term - term += "_" + ToString((unsigned)Digits); + term += "_" + std::to_string((unsigned)Digits); // construct float using cln::cl_F(const char *) ctor. if (imaginary) ctorval = ctorval + cln::complex(cln::cl_I(0),cln::cl_F(term.c_str())); @@ -502,20 +501,20 @@ static void print_real_cl_N(const print_context & c, const cln::cl_R & x) { if (cln::instanceof(x, cln::cl_I_ring)) { - int dst; - // fixnum - if (coerce(dst, cln::the(x))) { - // can be converted to native int - if (dst < 0) - c.s << "(-" << dst << ")"; - else - c.s << dst; - } else { - // bignum - c.s << "cln::cl_I(\""; - print_real_number(c, x); - c.s << "\")"; - } + int dst; + // fixnum + if (coerce(dst, cln::the(x))) { + // can be converted to native int + if (dst < 0) + c.s << "(-" << dst << ")"; + else + c.s << dst; + } else { + // bignum + c.s << "cln::cl_I(\""; + print_real_number(c, x); + c.s << "\")"; + } } else if (cln::instanceof(x, cln::cl_RA_ring)) { // Rational number @@ -1376,7 +1375,7 @@ const numeric numeric::numer() const if (cln::instanceof(r, cln::cl_RA_ring) && cln::instanceof(i, cln::cl_RA_ring)) { const cln::cl_I s = cln::lcm(cln::denominator(r), cln::denominator(i)); return numeric(cln::complex(cln::numerator(r)*(cln::exquo(s,cln::denominator(r))), - cln::numerator(i)*(cln::exquo(s,cln::denominator(i))))); + cln::numerator(i)*(cln::exquo(s,cln::denominator(i))))); } } // at least one float encountered @@ -1531,7 +1530,7 @@ const numeric atan(const numeric &y, const numeric &x) return *_num0_p; if (x.is_real() && y.is_real()) return numeric(cln::atan(cln::the(x.to_cl_N()), - cln::the(y.to_cl_N()))); + cln::the(y.to_cl_N()))); // Compute -I*log((x+I*y)/sqrt(x^2+y^2)) // == -I*log((x+I*y)/sqrt((x+I*y)*(x-I*y))) @@ -1775,8 +1774,8 @@ cln::cl_N lanczos_coeffs::calc_lanczos_A(const cln::cl_N &x) const { cln::cl_N A = (*current_vector)[0]; int size = current_vector->size(); - for (int i=1; i::const_iterator it = callbacklist.begin(), end = callbacklist.end(); - for (; it != end; ++it) { - (*it)(digitsdiff); + for (auto it : callbacklist) { + (it)(digitsdiff); } return *this;