Boost logo

Boost :

Subject: Re: [boost] [review] Multiprecision review (June 8th - 17th, 2012)
From: Christopher Kormanyos (e_float_at_[hidden])
Date: 2012-06-28 17:01:28


Thank you for taking the time to try the library, Mario.

> I hope it is not too late to give a short brief review of my experience with
> the Multiprecision library. First a general comment: this review is from a
> "naive user" perspective who just wants to use multiprecision and is happy
> finding a C++ library for that.

Users just wanting big number types are *the* target group.
In fact, I consider myself to be a naive user.

> My test case is to use floating point multiprecision types as the basis for
> our odeint library (www.odeint.com). As odeint is fully templatized I could
> just plug in, say, the cpp_dec_float_50 and the basic routines worked out of
> the box. The only problem I had was that there seems to be no support for min
> / max functions for expressions of multiprecision types. So can not write

> x = max( a+b , a*b )

It works when the template parameter of std::max() is explicitly provided.
The code below, for example, successfully compiles.

boost::multiprecision::cpp_dec_float_100 a(boost::multiprecision::cpp_dec_float_100(1) / 3);
boost::multiprecision::cpp_dec_float_100 b(boost::multiprecision::cpp_dec_float_100(1) / 7);
boost::multiprecision::cpp_dec_float_100 c = std::max<boost::multiprecision::cpp_dec_float_100>(a + b, a * b);

It does seem strange that the compiler needs an explicit template
parameter for dis-ambiguity regarding the results of binary arithmetic.

I don't have enough karma to know.
John, what's your opinion?

> when x,a,b are some mp types, however

> a1 = a+b
> a2 = a*b
> x = max( a1 , a2 )

> works and I used it as a workaround, however I would like to see full support
> of min/max in Multiprecision (maybe I just missed something?)

<snip>

Best, Mario

<snip>

Thanks again, Mario.
Best regards, Chris.


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