looks like I went to the wrong track. Yes, merely the pow function works. Thank you very much!


On Mon, Jan 20, 2014 at 8:42 AM, John Maddock <john@johnmaddock.co.uk> wrote:
I am trying to use eval_pow() and eval_powm()

Those are internal details, you shouldn't really be using them in user code.


My code is like this and I am using Visual Studio 12:

#include <boost/multiprecision/cpp_int.hpp>
...
boost::multiprecision::cpp_int pow("1234567");
boost::multiprecision::cpp_int base(3);
boost::multiprecision::cpp_int result = 0;

boost::multiprecision::default_ops::eval_pow(result, base, pow);

I cannot figure out what's going on wrong when I compile it, the error
message is like the following, Can anyone shed some light please?

The eval_* functions take *Backends* and not *numbers* as arguments.

In any case there is (deliberately) no integer pow function which accepts an arbitrary precision exponent value - even 2^INT_MAX would run the machine out of memory in a trice.

What's wrong with:

result = pow(base, 1234567);

and let the expression template code handle memory management?

John.
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users