]> www.ginac.de Git - ginac.git/commit
inifcns_nstdsums.cpp: S_num takes cl_N as an argument instead of numeric.
authorAlexei Sheplyakov <varg@theor.jinr.ru>
Wed, 19 Mar 2008 09:24:36 +0000 (12:24 +0300)
committerJens Vollinga <jensv@nikhef.nl>
Mon, 28 Jul 2008 19:22:23 +0000 (21:22 +0200)
commit2406529f5ceb193a46b1b5a07a8810880a8ceceb
tree90893e2a5e0e4d75f34c035ba71914270f2e2338
parente20fd5e760136cf343f4d2d73d0f3dfc6573ac49
inifcns_nstdsums.cpp: S_num takes cl_N as an argument instead of numeric.

Implicit conversion from cl_N to numeric considered harmful.

Using GiNaC::numeric for numerical computations incurs significant
overhead, so one might want to do these computations using proper CLN
types. Unfortunately, it's not easy due to automatic conversion from
cln::cl_N to GiNaC::numeric. Here is a simple example:

cl_N x, y;
// initialize them
return sin(x) +  y*exp(y);

The compiler complains about ambigously overloaded of functions, i.e.
cl_N cln::sin(const cl_N&) versus numeric GiNaC::sin(const numeric&).

Hence, I propose to disable *implicit* conversion from cl_N to numeric
(this can be done by marking the numeric ctor as `explicit').

However, this change happens to be a bit nontrivial, because that evil
conversion is used in GiNaC itself. So, I decided to rewrite those fragments
of code.
ginac/inifcns_nstdsums.cpp