I haven’t looked into this in detail, but I think not,
but Boost.Math does
#include
You might also need to add this to your local function(s) to aid Argument Dependant Lookup (ADL).
BOOST_MATH_STD_USING
http://www.boost.org/doc/libs/1_61_0/libs/math/doc/html/math_toolkit/config_...
Table 11. Boost.Math Macros
“Provides using statements for many std:: (abs to sqrt) and boost::math (rounds, modf) functions. This allows these functions to be called unqualified so that if http://en.wikipedia.org/wiki/Argument-dependent_name_lookup argument-dependent Argument Dependent Lookup fails to find a suitable overload, then the std:: versions will also be considered.”
HTH
Paul
From: Boost-users [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Daniel Brake
Sent: 03 August 2016 06:37
To: boost-users@lists.boost.org
Subject: [Boost-users] multiprecision modf
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::expression_template_option::et_on>,
bertini::generators::BertiniNumPolicy,
boost::multiprecision::expression_template_option::et_on> >, boost::spirit::unused_type,
boost::spirit::unused_type>::call_n,
mpl_::int_<0>, boost::spirit::unused_type>, boost::multiprecision::number,
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::expression_template_option::et_on>
>::call,
boost::multiprecision::expression_template_option::et_on>,
bertini::generators::BertiniNumPolicy,
boost::multiprecision::expression_template_option::et_on> >, boost::spirit::unused_type, boost::spirit::unused_type>,
boost::spirit::karma::detail::output_iterator, mpl_::int_<0>,
boost::spirit::unused_type>,
bertini::generators::BertiniNumPolicy,
boost::multiprecision::expression_template_option::et_on> > >' requested here
return p.template call(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::expression_template_option::et_on>,
bertini::generators::BertiniNumPolicy,
boost::multiprecision::expression_template_option::et_on> >, boost::spirit::unused_type,
boost::spirit::unused_type>::call,
mpl_::int_<0>, boost::spirit::unused_type>, boost::multiprecision::number,
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::expression_template_option::et_on>,
bertini::generators::BertiniNumPolicy,
boost::multiprecision::expression_template_option::et_on> >, boost::spirit::unused_type,
boost::spirit::unused_type>::generate,
mpl_::int_<0>, boost::spirit::unused_type>, boost::spirit::context,
boost::multiprecision::expression_template_option::et_on> &, boost::fusion::nil_>, boost::spirit::locals >, boost::spirit::unused_type,
boost::multiprecision::number,
boost::multiprecision::expression_template_option::et_on> >' requested here
return compilekarma::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, mpl_::int_<0>,
boost::spirit::karma::real_generator,
boost::multiprecision::expression_template_option::et_on>,
bertini::generators::BertiniNumPolicy,
boost::multiprecision::expression_template_option::et_on> > >, boost::multiprecision::number, 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,
boost::spirit::karma::real_generator,
boost::multiprecision::expression_template_option::et_on>,
bertini::generators::BertiniNumPolicy,
boost::multiprecision::expression_template_option::et_on> > >, boost::multiprecision::number, 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 >' 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::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::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::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