Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:40:43

0001 //  Copyright (c) 2006-7 John Maddock
0002 //  Use, modification and distribution are subject to the
0003 //  Boost Software License, Version 1.0. (See accompanying file
0004 //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0005 
0006 #ifndef BOOST_MATH_TOOLS_WORHAROUND_HPP
0007 #define BOOST_MATH_TOOLS_WORHAROUND_HPP
0008 
0009 #ifdef _MSC_VER
0010 #pragma once
0011 #endif
0012 
0013 #if (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__))
0014 #  include <math.h>
0015 #endif
0016 
0017 #include <boost/math/tools/config.hpp>
0018 
0019 namespace boost{ namespace math{ namespace tools{
0020 //
0021 // We call this short forwarding function so that we can work around a bug
0022 // on Darwin that causes std::fmod to return a NaN.  The test case is:
0023 // std::fmod(1185.0L, 1.5L);
0024 //
0025 template <class T>
0026 inline T fmod_workaround(T a, T b) BOOST_MATH_NOEXCEPT(T)
0027 {
0028    BOOST_MATH_STD_USING
0029    return fmod(a, b);
0030 }
0031 #if (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) && ((LDBL_MANT_DIG == 106) || (__LDBL_MANT_DIG__ == 106))
0032 template <>
0033 inline long double fmod_workaround(long double a, long double b) noexcept
0034 {
0035    return ::fmodl(a, b);
0036 }
0037 #endif
0038 
0039 }}} // namespaces
0040 
0041 #endif // BOOST_MATH_TOOLS_WORHAROUND_HPP
0042