Boost logo

Boost Users :

Subject: Re: [Boost-users] Cannot compile with multiprecision :: eval_*()functions
From: John Maddock (john_at_[hidden])
Date: 2014-01-20 11:42:03


> 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 list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net