Boost logo

Boost :

Subject: Re: [boost] RFC: Multiprecision arithmetic library
From: John Maddock (boost.regex_at_[hidden])
Date: 2011-12-22 12:59:19


>> I'd like to get some feedback on a multiprecision arithmetic library
>> I've been preparing for possible Boost inclusion. The code is in the
>> sandbox under the "big_number" directory. Docs can be viewed online
>> here:
>> http://svn.boost.org/svn/boost/sandbox/big_number/libs/multiprecision/doc/html/boost_multiprecision/intro.html
>
> It looks really good!
>
> One question: is it possible to an mp_number from one backend to another
> one in some other backend (without having to go mp_number1 -> string ->
> mp_number2 of course)?

Maybe ;-)

An mp_number is copy-constructible from anything that the backend is
copy-constructible from.

So related types typically interconvert - for example all the GMP supported
types interconvert, and can also be constructed from the raw GMP C struct
types. However, unrelated types do not interconvert, so for example a
number based on the cpp_float backend doesn't convert to one based on the
GMP MPF backend. Given that their internal data structures are quite
different I don't see how they can interconvert either - except via a
lexical_cast.

HTH, John.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk