Boost logo

Boost :

Subject: Re: [boost] Looking for some "real world" extended precision integer arithmetic tests
From: Andrii Sydorchuk (sydorchuk.andriy_at_[hidden])
Date: 2012-01-25 17:10:11


John,

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.

Regards,
Andrii


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