brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 7edd1c1 Raw
43 lines · plain
1//  Copyright (c) 2006-7 John Maddock2//  Use, modification and distribution are subject to the3//  Boost Software License, Version 1.0. (See accompanying file4//  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)5 6#ifndef BOOST_MATH_TOOLS_WORHAROUND_HPP7#define BOOST_MATH_TOOLS_WORHAROUND_HPP8 9#ifdef _MSC_VER10#pragma once11#endif12 13#if (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__))14#  include <math.h>15#endif16 17#include <boost/math/tools/config.hpp>18 19namespace boost{ namespace math{ namespace tools{20//21// We call this short forwarding function so that we can work around a bug22// on Darwin that causes std::fmod to return a NaN.  The test case is:23// std::fmod(1185.0L, 1.5L);24//25template <class T>26BOOST_MATH_GPU_ENABLED inline T fmod_workaround(T a, T b) BOOST_MATH_NOEXCEPT(T)27{28   BOOST_MATH_STD_USING29   return fmod(a, b);30}31#if (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) && ((LDBL_MANT_DIG == 106) || (__LDBL_MANT_DIG__ == 106))32template <>33inline long double fmod_workaround(long double a, long double b) noexcept34{35   return ::fmodl(a, b);36}37#endif38 39}}} // namespaces40 41#endif // BOOST_MATH_TOOLS_WORHAROUND_HPP42 43