|
Boost : |
Subject: [boost] [multiprecision] Bug in double to cpp_bin_float conversion?
From: Rob Conde (rob.conde_at_[hidden])
Date: 2016-04-13 17:32:12
Consider the following code:
#include <boost/multiprecision/cpp_bin_float.hpp>
#include <iostream>
int main()
{
typedef boost::multiprecision::cpp_bin_float_quad float128_t;
float128_t f1(1e-9);
float128_t f2("1e-9");
std::cout << std::setprecision(std::numeric_limits<float128_t>::max_digits10);
std::cout << f1 << std::endl;
std::cout << f2 << std::endl;
return 0;
}
I'm getting as output:
1.000000000000000062281591457779856419e-09
9.999999999999999999999999999999999325e-10
The conversion of the double literal is not as expected.
On wand box: http://melpon.org/wandbox/permlink/uSGNQZAEEytmb3ao
Is this a bug? If not, what would be the correct way to get my expected behavior?
Thanks,
Rob Conde
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk