Chris@16: // Copyright (c) 2006-7 John Maddock Chris@16: // Use, modification and distribution are subject to the Chris@16: // Boost Software License, Version 1.0. (See accompanying file Chris@16: // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: #ifndef BOOST_MATH_TOOLS_WORHAROUND_HPP Chris@16: #define BOOST_MATH_TOOLS_WORHAROUND_HPP Chris@16: Chris@16: #ifdef _MSC_VER Chris@16: #pragma once Chris@16: #endif Chris@16: Chris@16: #include Chris@16: Chris@16: namespace boost{ namespace math{ namespace tools{ Chris@16: // Chris@16: // We call this short forwarding function so that we can work around a bug Chris@16: // on Darwin that causes std::fmod to return a NaN. The test case is: Chris@16: // std::fmod(1185.0L, 1.5L); Chris@16: // Chris@16: template Chris@16: inline T fmod_workaround(T a, T b) Chris@16: { Chris@16: BOOST_MATH_STD_USING Chris@16: return fmod(a, b); Chris@16: } Chris@16: #if (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) && ((LDBL_MANT_DIG == 106) || (__LDBL_MANT_DIG__ == 106)) Chris@16: template <> Chris@16: inline long double fmod_workaround(long double a, long double b) Chris@16: { Chris@16: return ::fmodl(a, b); Chris@16: } Chris@16: #endif Chris@16: Chris@16: }}} // namespaces Chris@16: Chris@16: #endif // BOOST_MATH_TOOLS_WORHAROUND_HPP Chris@16: