Boost logo

Boost :

Subject: Re: [boost] Looking for some "real world" extended precision integer arithmetic tests
From: John Maddock (boost.regex_at_[hidden])
Date: 2012-01-26 05:12:45


> It took me some time to figure out that convert_to<double>() method
> doesn't
> work properly for negative integers (Please correct me if I'm wrong).
> Here is the code snippet:
>
> #include "boost/multiprecision/fixed_int.hpp"
> using namespace boost::multiprecision;
>
> int main() {
> mp_int512_t a = 1;
> double da = a.convert_to<double>();
> mp_int512_t b = -1;
> double db = b.convert_to<double>();
> std::cout << da << std::endl; // Outputs: 1
> std::cout << db << std::endl; // Outputs: 1.34078e+154
> return 0;
> }
>
> As soon as this fix is ready, I'll be able to finish benchmark.

Ugh. Looks like that slipped through the test cases. That and a couple
other bugs fixed in SVN.

Cheers, John.


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