Boost logo

Boost Users :

Subject: [Boost-users] multiprecision modf
From: Daniel Brake (danielthebrake_at_[hidden])
Date: 2016-08-03 01:36:58


Hi Boost,

Does Boost.Multiprecision provide modf for floating point types? I need it
for generating with Karma, unless the fact that mpfr_float with variable
precision not having numeric_traits might get in the way.

Thanks for any help. Error message follows.

In file included from test/generating/mpfr_float.cpp:27:
In file included from ./include/bertini2/io/generators.hpp:38:
In file included from /usr/local/include/boost/spirit/include/karma.hpp:16:
In file included from /usr/local/include/boost/spirit/home/karma.hpp:15:
In file included from
/usr/local/include/boost/spirit/home/karma/numeric.hpp:16:
In file included from
/usr/local/include/boost/spirit/home/karma/numeric/real.hpp:32:
In file included from
/usr/local/include/boost/spirit/home/karma/numeric/real_policies.hpp:21:
/usr/local/include/boost/spirit/home/karma/numeric/detail/real_utils.hpp:115:33:
error: no matching function for call to 'modf'
            U fractional_part = modf(n, &integer_part);
                                ^~~~
/usr/local/include/boost/spirit/home/karma/numeric/real_policies.hpp:94:30:
note: in instantiation of function template specialization

'boost::spirit::karma::real_inserter<boost::multiprecision::number<boost::multiprecision::backends::mpfr_float_backend<0,
allocate_dynamic>,
      boost::multiprecision::expression_template_option::et_on>,

bertini::generators::BertiniNumPolicy<boost::multiprecision::number<boost::multiprecision::backends::mpfr_float_backend<0,
allocate_dynamic>,
      boost::multiprecision::expression_template_option::et_on> >,
boost::spirit::unused_type,

boost::spirit::unused_type>::call_n<boost::spirit::karma::detail::output_iterator<std::__1::back_insert_iterator<std::__1::basic_string<char>
>,
      mpl_::int_<0>, boost::spirit::unused_type>,
boost::multiprecision::number<boost::multiprecision::backends::mpfr_float_backend<0,
allocate_dynamic>,
      boost::multiprecision::expression_template_option::et_on> >'
requested here
            return Inserter::call_n(sink, n, p);
                             ^
/usr/local/include/boost/spirit/home/karma/numeric/detail/real_utils.hpp:56:31:
note: in instantiation of function template specialization

'boost::spirit::karma::real_policies<boost::multiprecision::number<boost::multiprecision::backends::mpfr_float_backend<0,
allocate_dynamic>,
      boost::multiprecision::expression_template_option::et_on>

>::call<boost::spirit::karma::real_inserter<boost::multiprecision::number<boost::multiprecision::backends::mpfr_float_backend<0,
allocate_dynamic>,
      boost::multiprecision::expression_template_option::et_on>,

bertini::generators::BertiniNumPolicy<boost::multiprecision::number<boost::multiprecision::backends::mpfr_float_backend<0,
allocate_dynamic>,
      boost::multiprecision::expression_template_option::et_on> >,
boost::spirit::unused_type, boost::spirit::unused_type>,

boost::spirit::karma::detail::output_iterator<std::__1::back_insert_iterator<std::__1::basic_string<char>
>, mpl_::int_<0>,
      boost::spirit::unused_type>,

bertini::generators::BertiniNumPolicy<boost::multiprecision::number<boost::multiprecision::backends::mpfr_float_backend<0,
allocate_dynamic>,
      boost::multiprecision::expression_template_option::et_on> > >'
requested here
            return p.template call<real_inserter>(sink, n, p);
                              ^
/usr/local/include/boost/spirit/home/karma/numeric/real.hpp:192:35: note:
in instantiation of function template specialization

'boost::spirit::karma::real_inserter<boost::multiprecision::number<boost::multiprecision::backends::mpfr_float_backend<0,
allocate_dynamic>,
      boost::multiprecision::expression_template_option::et_on>,

bertini::generators::BertiniNumPolicy<boost::multiprecision::number<boost::multiprecision::backends::mpfr_float_backend<0,
allocate_dynamic>,
      boost::multiprecision::expression_template_option::et_on> >,
boost::spirit::unused_type,

boost::spirit::unused_type>::call<boost::spirit::karma::detail::output_iterator<std::__1::back_insert_iterator<std::__1::basic_string<char>
>,
      mpl_::int_<0>, boost::spirit::unused_type>,
boost::multiprecision::number<boost::multiprecision::backends::mpfr_float_backend<0,
allocate_dynamic>,
      boost::multiprecision::expression_template_option::et_on> >'
requested here
            return inserter_type::call(sink, traits::extract_from<T>(attr,
context), p_) &&
                                  ^
/usr/local/include/boost/spirit/home/karma/generate.hpp:69:45: note: in
instantiation of function template specialization

'boost::spirit::karma::any_real_generator<boost::multiprecision::number<boost::multiprecision::backends::mpfr_float_backend<0,
allocate_dynamic>,
      boost::multiprecision::expression_template_option::et_on>,

bertini::generators::BertiniNumPolicy<boost::multiprecision::number<boost::multiprecision::backends::mpfr_float_backend<0,
allocate_dynamic>,
      boost::multiprecision::expression_template_option::et_on> >,
boost::spirit::unused_type,

boost::spirit::unused_type>::generate<boost::spirit::karma::detail::output_iterator<std::__1::back_insert_iterator<std::__1::basic_string<char>
>,
      mpl_::int_<0>, boost::spirit::unused_type>,
boost::spirit::context<boost::fusion::cons<const

boost::multiprecision::number<boost::multiprecision::backends::mpfr_float_backend<0,
allocate_dynamic>,
      boost::multiprecision::expression_template_option::et_on> &,
boost::fusion::nil_>, boost::spirit::locals<mpl_::na, mpl_::na, mpl_::na,
mpl_::na,
      mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na> >,
boost::spirit::unused_type,

boost::multiprecision::number<boost::multiprecision::backends::mpfr_float_backend<0,
allocate_dynamic>,
      boost::multiprecision::expression_template_option::et_on> >'
requested here
        return compile<karma::domain>(expr).generate(sink, context, unused,
attr);
                                            ^
/usr/local/include/boost/spirit/home/karma/generate.hpp:91:23: note: in
instantiation of function template specialization

'boost::spirit::karma::generate<std::__1::back_insert_iterator<std::__1::basic_string<char>
>, mpl_::int_<0>,

boost::spirit::karma::real_generator<boost::multiprecision::number<boost::multiprecision::backends::mpfr_float_backend<0,
allocate_dynamic>,
      boost::multiprecision::expression_template_option::et_on>,

bertini::generators::BertiniNumPolicy<boost::multiprecision::number<boost::multiprecision::backends::mpfr_float_backend<0,
allocate_dynamic>,
      boost::multiprecision::expression_template_option::et_on> > >,
boost::multiprecision::number<boost::multiprecision::backends::mpfr_float_backend<0,
      allocate_dynamic>,
boost::multiprecision::expression_template_option::et_on> >' requested here
        return karma::generate(sink, expr, attr);
                      ^
./include/bertini2/io/generators.hpp:149:21: note: in instantiation of
function template specialization

'boost::spirit::karma::generate<std::__1::back_insert_iterator<std::__1::basic_string<char>
>,

boost::spirit::karma::real_generator<boost::multiprecision::number<boost::multiprecision::backends::mpfr_float_backend<0,
allocate_dynamic>,
      boost::multiprecision::expression_template_option::et_on>,

bertini::generators::BertiniNumPolicy<boost::multiprecision::number<boost::multiprecision::backends::mpfr_float_backend<0,
allocate_dynamic>,
      boost::multiprecision::expression_template_option::et_on> > >,
boost::multiprecision::number<boost::multiprecision::backends::mpfr_float_backend<0,
      allocate_dynamic>,
boost::multiprecision::expression_template_option::et_on> >' requested here
                    return generate(sink,
                           ^
test/generating/mpfr_float.cpp:53:47: note: in instantiation of function
template specialization

'bertini::generators::Classic::generate<std::__1::back_insert_iterator<std::__1::basic_string<char>
> >' requested here
    BOOST_CHECK(bertini::generators::Classic::generate(sink, z));
                                              ^
/usr/include/math.h:407:15: note: candidate function not viable: no known
conversion from

'boost::multiprecision::number<boost::multiprecision::backends::mpfr_float_backend<0,
allocate_dynamic>,
      boost::multiprecision::expression_template_option::et_on>' to
'double' for 1st argument
extern double modf(double, double *);
              ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:940:46:
note: candidate function not
      viable: no known conversion from
'boost::multiprecision::number<boost::multiprecision::backends::mpfr_float_backend<0,
allocate_dynamic>,
      boost::multiprecision::expression_template_option::et_on>' to 'float'
for 1st argument
inline _LIBCPP_INLINE_VISIBILITY float modf(float __lcpp_x, float*
__lcpp_y) _NOEXCEPT {return modff(__lcpp_x, __lcpp_y);}
                                             ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:941:46:
note: candidate function not
      viable: no known conversion from
'boost::multiprecision::number<boost::multiprecision::backends::mpfr_float_backend<0,
allocate_dynamic>,
      boost::multiprecision::expression_template_option::et_on>' to 'long
double' for 1st argument
inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __lcpp_x,
long double* __lcpp_y) _NOEXCEPT {return modfl(__lcpp_x, __lcpp_y);}

Daniel Brake



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