Index: boost/spirit/home/karma/numeric/detail/numeric_utils.hpp =================================================================== --- boost/spirit/home/karma/numeric/detail/numeric_utils.hpp (revision 81163) +++ boost/spirit/home/karma/numeric/detail/numeric_utils.hpp (working copy) @@ -545,6 +545,31 @@ return call(n, mpl::bool_::value>()); } }; + + /////////////////////////////////////////////////////////////////////// + struct decompose_real + { + template + static T call(T n, T* iptr, mpl::true_) + { + *iptr = n; + return T(0); + } + + template + static T call(T n, T* iptr, mpl::false_) + { + // Allow ADL to find the correct overload for modf + using namespace std; + return modf(n, iptr); + } + + template + static T call(T n, T* iptr) + { + return call(n, iptr, mpl::bool_::value>()); + } + }; }}} namespace boost { namespace spirit { namespace karma Index: boost/spirit/home/karma/numeric/detail/real_utils.hpp =================================================================== --- boost/spirit/home/karma/numeric/detail/real_utils.hpp (revision 81163) +++ boost/spirit/home/karma/numeric/detail/real_utils.hpp (working copy) @@ -112,7 +112,7 @@ // prepare numbers (sign, integer and fraction part) U integer_part; U precexp = spirit::traits::pow10(precision); - U fractional_part = modf(n, &integer_part); + U fractional_part = spirit::traits::decompose_real::call(n, &integer_part); fractional_part = floor(fractional_part * precexp + U(0.5)); if (fractional_part >= precexp)