comparison DEPENDENCIES/generic/include/boost/math/tools/workaround.hpp @ 16:2665513ce2d3

Add boost headers
author Chris Cannam
date Tue, 05 Aug 2014 11:11:38 +0100
parents
children
comparison
equal deleted inserted replaced
15:663ca0da4350 16:2665513ce2d3
1 // Copyright (c) 2006-7 John Maddock
2 // Use, modification and distribution are subject to the
3 // Boost Software License, Version 1.0. (See accompanying file
4 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6 #ifndef BOOST_MATH_TOOLS_WORHAROUND_HPP
7 #define BOOST_MATH_TOOLS_WORHAROUND_HPP
8
9 #ifdef _MSC_VER
10 #pragma once
11 #endif
12
13 #include <boost/math/tools/config.hpp>
14
15 namespace boost{ namespace math{ namespace tools{
16 //
17 // We call this short forwarding function so that we can work around a bug
18 // on Darwin that causes std::fmod to return a NaN. The test case is:
19 // std::fmod(1185.0L, 1.5L);
20 //
21 template <class T>
22 inline T fmod_workaround(T a, T b)
23 {
24 BOOST_MATH_STD_USING
25 return fmod(a, b);
26 }
27 #if (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) && ((LDBL_MANT_DIG == 106) || (__LDBL_MANT_DIG__ == 106))
28 template <>
29 inline long double fmod_workaround(long double a, long double b)
30 {
31 return ::fmodl(a, b);
32 }
33 #endif
34
35 }}} // namespaces
36
37 #endif // BOOST_MATH_TOOLS_WORHAROUND_HPP
38