double - How to convert boost::multiprecision::int512_t to boost::multiprecision::cpp_dec_float_100? -
i'm using boost::multiprecision recently. code this:
#include <iostream> #include <boost/multiprecision/cpp_int.hpp> #include <boost/multiprecision/cpp_dec_float.hpp> namespace bm = boost::multiprecision; int main(void) { bm::int512_t = 12; bm::cpp_dec_float_100 f = a; std::cout << f * 3.14 << std::endl; return 0; }
it didn't compiled. error shows:
b.cpp: in function ‘int main()’: b.cpp:9:28: error: conversion ‘boost::multiprecision::int512_t {aka boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<512u, 512u, (boost::multiprecision::cpp_integer_type)1u, (boost::multiprecision::cpp_int_check_type)0u, void> >}’ non-scalar type ‘boost::multiprecision::cpp_dec_float_100 {aka boost::multiprecision::number<boost::multiprecision::backends::cpp_dec_float<100u> >}’ requested bm::cpp_dec_float_100 f = a; ^ how can convert correctly? lot!
i new stuff myself i've been using boost multi_precision quite lot, imagine below should work
bm::cpp_dec_float_100 f = bm::cpp_dec_float_100 f(a);
Comments
Post a Comment