Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost][multiprecision] compile error with gcc 4.8.4
From: Rob Conde (rob.conde_at_[hidden])
Date: 2016-09-17 13:35:51


The following works with me in visual studio with toolset v120 and v140.

#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_bin_float.hpp>
#include <iostream>

typedef boost::multiprecision::int128_t int128_t;
typedef boost::multiprecision::cpp_bin_float_quad float128_t;

void main()
{
   float128_t floatVal("6.0");

   int128_t iVal(floatVal.convert_to<int128_t>());

   std::cout << iVal << std::endl;
}

If I change it to have a fractional component, then indeed I get an exception...maybe that's what you mean. I personally only need the above behavior (though keeping the c++ truncation semantics might make sense as a long term goal...but i digress). I always floor/ceil because call convert_to<int128_t>().

Using boost 1.61 and gcc version 4.4.7, the above also compiles and works.

Rob



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net