1013 lines · plain
1///////////////////////////////////////////////////////////////////////////////2// Copyright Christopher Kormanyos 2014.3// Copyright John Maddock 2014.4// Copyright Paul Bristow 2014.5// Distributed under the Boost Software License,6// Version 1.0. (See accompanying file LICENSE_1_0.txt7// or copy at http://www.boost.org/LICENSE_1_0.txt)8//9 10// Implement quadruple-precision <cmath> support.11 12#ifndef BOOST_MATH_CSTDFLOAT_CMATH_2014_02_15_HPP_13#define BOOST_MATH_CSTDFLOAT_CMATH_2014_02_15_HPP_14 15#include <boost/math/cstdfloat/cstdfloat_types.hpp>16#include <boost/math/cstdfloat/cstdfloat_limits.hpp>17 18#if (defined(__GNUC__) && defined(BOOST_HAS_FLOAT128))19//20// This is the only way we can avoid21// warning: non-standard suffix on floating constant [-Wpedantic]22// when building with -Wall -pedantic. Neither __extension__23// nor #pragma diagnostic ignored work :(24//25#pragma GCC system_header26#endif27 28#if defined(BOOST_CSTDFLOAT_HAS_INTERNAL_FLOAT128_T) && defined(BOOST_MATH_USE_FLOAT128) && !defined(BOOST_CSTDFLOAT_NO_LIBQUADMATH_SUPPORT)29 30#include <cstdint>31#include <cmath>32#include <stdexcept>33#include <iostream>34#include <type_traits>35#include <memory>36#include <boost/math/tools/assert.hpp>37#include <boost/math/tools/nothrow.hpp>38#include <boost/math/tools/throw_exception.hpp>39 40#if defined(_WIN32) && defined(__GNUC__)41 // Several versions of Mingw and probably cygwin too have broken42 // libquadmath implementations that segfault as soon as you call43 // expq or any function that depends on it.44#define BOOST_CSTDFLOAT_BROKEN_FLOAT128_MATH_FUNCTIONS45#endif46 47// Here is a helper function used for raising the value of a given48// floating-point type to the power of n, where n has integral type.49namespace boost {50 namespace math {51 namespace cstdfloat {52 namespace detail {53 54 template<class float_type, class integer_type>55 inline float_type pown(const float_type& x, const integer_type p)56 {57 const bool isneg = (x < 0);58 const bool isnan = (x != x);59 const bool isinf = ((!isneg) ? bool(+x > (std::numeric_limits<float_type>::max)())60 : bool(-x > (std::numeric_limits<float_type>::max)()));61 62 if (isnan) { return x; }63 64 if (isinf) { return std::numeric_limits<float_type>::quiet_NaN(); }65 66 const bool x_is_neg = (x < 0);67 const float_type abs_x = (x_is_neg ? -x : x);68 69 if (p < static_cast<integer_type>(0))70 {71 if (abs_x < (std::numeric_limits<float_type>::min)())72 {73 return (x_is_neg ? -std::numeric_limits<float_type>::infinity()74 : +std::numeric_limits<float_type>::infinity());75 }76 else77 {78 return float_type(1) / pown(x, static_cast<integer_type>(-p));79 }80 }81 82 if (p == static_cast<integer_type>(0))83 {84 return float_type(1);85 }86 else87 {88 if (p == static_cast<integer_type>(1)) { return x; }89 90 if (abs_x > (std::numeric_limits<float_type>::max)())91 {92 return (x_is_neg ? -std::numeric_limits<float_type>::infinity()93 : +std::numeric_limits<float_type>::infinity());94 }95 96 if (p == static_cast<integer_type>(2)) { return (x * x); }97 else if (p == static_cast<integer_type>(3)) { return ((x * x) * x); }98 else if (p == static_cast<integer_type>(4)) { const float_type x2 = (x * x); return (x2 * x2); }99 else100 {101 // The variable xn stores the binary powers of x.102 float_type result(((p % integer_type(2)) != integer_type(0)) ? x : float_type(1));103 float_type xn(x);104 105 integer_type p2 = p;106 107 while (integer_type(p2 /= 2) != integer_type(0))108 {109 // Square xn for each binary power.110 xn *= xn;111 112 const bool has_binary_power = (integer_type(p2 % integer_type(2)) != integer_type(0));113 114 if (has_binary_power)115 {116 // Multiply the result with each binary power contained in the exponent.117 result *= xn;118 }119 }120 121 return result;122 }123 }124 }125 126 }127 }128 }129} // boost::math::cstdfloat::detail130 131// We will now define preprocessor symbols representing quadruple-precision <cmath> functions.132#if defined(__INTEL_COMPILER)133#define BOOST_CSTDFLOAT_FLOAT128_LDEXP __ldexpq134#define BOOST_CSTDFLOAT_FLOAT128_FREXP __frexpq135#define BOOST_CSTDFLOAT_FLOAT128_FABS __fabsq136#define BOOST_CSTDFLOAT_FLOAT128_FLOOR __floorq137#define BOOST_CSTDFLOAT_FLOAT128_CEIL __ceilq138#if !defined(BOOST_CSTDFLOAT_FLOAT128_SQRT)139#define BOOST_CSTDFLOAT_FLOAT128_SQRT __sqrtq140#endif141#define BOOST_CSTDFLOAT_FLOAT128_TRUNC __truncq142#define BOOST_CSTDFLOAT_FLOAT128_EXP __expq143#define BOOST_CSTDFLOAT_FLOAT128_EXPM1 __expm1q144#define BOOST_CSTDFLOAT_FLOAT128_POW __powq145#define BOOST_CSTDFLOAT_FLOAT128_LOG __logq146#define BOOST_CSTDFLOAT_FLOAT128_LOG10 __log10q147#define BOOST_CSTDFLOAT_FLOAT128_SIN __sinq148#define BOOST_CSTDFLOAT_FLOAT128_COS __cosq149#define BOOST_CSTDFLOAT_FLOAT128_TAN __tanq150#define BOOST_CSTDFLOAT_FLOAT128_ASIN __asinq151#define BOOST_CSTDFLOAT_FLOAT128_ACOS __acosq152#define BOOST_CSTDFLOAT_FLOAT128_ATAN __atanq153#define BOOST_CSTDFLOAT_FLOAT128_SINH __sinhq154#define BOOST_CSTDFLOAT_FLOAT128_COSH __coshq155#define BOOST_CSTDFLOAT_FLOAT128_TANH __tanhq156#define BOOST_CSTDFLOAT_FLOAT128_ASINH __asinhq157#define BOOST_CSTDFLOAT_FLOAT128_ACOSH __acoshq158#define BOOST_CSTDFLOAT_FLOAT128_ATANH __atanhq159#define BOOST_CSTDFLOAT_FLOAT128_FMOD __fmodq160#define BOOST_CSTDFLOAT_FLOAT128_ATAN2 __atan2q161#define BOOST_CSTDFLOAT_FLOAT128_LGAMMA __lgammaq162#define BOOST_CSTDFLOAT_FLOAT128_TGAMMA __tgammaq163// begin more functions164#define BOOST_CSTDFLOAT_FLOAT128_REMAINDER __remainderq165#define BOOST_CSTDFLOAT_FLOAT128_REMQUO __remquoq166#define BOOST_CSTDFLOAT_FLOAT128_FMA __fmaq167#define BOOST_CSTDFLOAT_FLOAT128_FMAX __fmaxq168#define BOOST_CSTDFLOAT_FLOAT128_FMIN __fminq169#define BOOST_CSTDFLOAT_FLOAT128_FDIM __fdimq170#define BOOST_CSTDFLOAT_FLOAT128_NAN __nanq171//#define BOOST_CSTDFLOAT_FLOAT128_EXP2 __exp2q172#define BOOST_CSTDFLOAT_FLOAT128_LOG2 __log2q173#define BOOST_CSTDFLOAT_FLOAT128_LOG1P __log1pq174#define BOOST_CSTDFLOAT_FLOAT128_CBRT __cbrtq175#define BOOST_CSTDFLOAT_FLOAT128_HYPOT __hypotq176#define BOOST_CSTDFLOAT_FLOAT128_ERF __erfq177#define BOOST_CSTDFLOAT_FLOAT128_ERFC __erfcq178#define BOOST_CSTDFLOAT_FLOAT128_LLROUND __llroundq179#define BOOST_CSTDFLOAT_FLOAT128_LROUND __lroundq180#define BOOST_CSTDFLOAT_FLOAT128_ROUND __roundq181#define BOOST_CSTDFLOAT_FLOAT128_NEARBYINT __nearbyintq182#define BOOST_CSTDFLOAT_FLOAT128_LLRINT __llrintq183#define BOOST_CSTDFLOAT_FLOAT128_LRINT __lrintq184#define BOOST_CSTDFLOAT_FLOAT128_RINT __rintq185#define BOOST_CSTDFLOAT_FLOAT128_MODF __modfq186#define BOOST_CSTDFLOAT_FLOAT128_SCALBLN __scalblnq187#define BOOST_CSTDFLOAT_FLOAT128_SCALBN __scalbnq188#define BOOST_CSTDFLOAT_FLOAT128_ILOGB __ilogbq189#define BOOST_CSTDFLOAT_FLOAT128_LOGB __logbq190#define BOOST_CSTDFLOAT_FLOAT128_NEXTAFTER __nextafterq191//#define BOOST_CSTDFLOAT_FLOAT128_NEXTTOWARD __nexttowardq192#define BOOST_CSTDFLOAT_FLOAT128_COPYSIGN __copysignq193#define BOOST_CSTDFLOAT_FLOAT128_SIGNBIT __signbitq194//#define BOOST_CSTDFLOAT_FLOAT128_FPCLASSIFY __fpclassifyq195//#define BOOST_CSTDFLOAT_FLOAT128_ISFINITE __isfiniteq196#define BOOST_CSTDFLOAT_FLOAT128_ISINF __isinfq197#define BOOST_CSTDFLOAT_FLOAT128_ISNAN __isnanq198//#define BOOST_CSTDFLOAT_FLOAT128_ISNORMAL __isnormalq199//#define BOOST_CSTDFLOAT_FLOAT128_ISGREATER __isgreaterq200//#define BOOST_CSTDFLOAT_FLOAT128_ISGREATEREQUAL __isgreaterequalq201//#define BOOST_CSTDFLOAT_FLOAT128_ISLESS __islessq202//#define BOOST_CSTDFLOAT_FLOAT128_ISLESSEQUAL __islessequalq203//#define BOOST_CSTDFLOAT_FLOAT128_ISLESSGREATER __islessgreaterq204//#define BOOST_CSTDFLOAT_FLOAT128_ISUNORDERED __isunorderedq205// end more functions206#elif defined(__GNUC__)207#define BOOST_CSTDFLOAT_FLOAT128_LDEXP ldexpq208#define BOOST_CSTDFLOAT_FLOAT128_FREXP frexpq209#define BOOST_CSTDFLOAT_FLOAT128_FABS fabsq210#define BOOST_CSTDFLOAT_FLOAT128_FLOOR floorq211#define BOOST_CSTDFLOAT_FLOAT128_CEIL ceilq212#if !defined(BOOST_CSTDFLOAT_FLOAT128_SQRT)213#define BOOST_CSTDFLOAT_FLOAT128_SQRT sqrtq214#endif215#define BOOST_CSTDFLOAT_FLOAT128_TRUNC truncq216#define BOOST_CSTDFLOAT_FLOAT128_POW powq217#define BOOST_CSTDFLOAT_FLOAT128_LOG logq218#define BOOST_CSTDFLOAT_FLOAT128_LOG10 log10q219#define BOOST_CSTDFLOAT_FLOAT128_SIN sinq220#define BOOST_CSTDFLOAT_FLOAT128_COS cosq221#define BOOST_CSTDFLOAT_FLOAT128_TAN tanq222#define BOOST_CSTDFLOAT_FLOAT128_ASIN asinq223#define BOOST_CSTDFLOAT_FLOAT128_ACOS acosq224#define BOOST_CSTDFLOAT_FLOAT128_ATAN atanq225#define BOOST_CSTDFLOAT_FLOAT128_FMOD fmodq226#define BOOST_CSTDFLOAT_FLOAT128_ATAN2 atan2q227#define BOOST_CSTDFLOAT_FLOAT128_LGAMMA lgammaq228#if !defined(BOOST_CSTDFLOAT_BROKEN_FLOAT128_MATH_FUNCTIONS)229#define BOOST_CSTDFLOAT_FLOAT128_EXP expq230#define BOOST_CSTDFLOAT_FLOAT128_EXPM1 expm1q231#define BOOST_CSTDFLOAT_FLOAT128_SINH sinhq232#define BOOST_CSTDFLOAT_FLOAT128_COSH coshq233#define BOOST_CSTDFLOAT_FLOAT128_TANH tanhq234#define BOOST_CSTDFLOAT_FLOAT128_ASINH asinhq235#define BOOST_CSTDFLOAT_FLOAT128_ACOSH acoshq236#define BOOST_CSTDFLOAT_FLOAT128_ATANH atanhq237#define BOOST_CSTDFLOAT_FLOAT128_TGAMMA tgammaq238#else // BOOST_CSTDFLOAT_BROKEN_FLOAT128_MATH_FUNCTIONS239#define BOOST_CSTDFLOAT_FLOAT128_EXP expq_patch240#define BOOST_CSTDFLOAT_FLOAT128_SINH sinhq_patch241#define BOOST_CSTDFLOAT_FLOAT128_COSH coshq_patch242#define BOOST_CSTDFLOAT_FLOAT128_TANH tanhq_patch243#define BOOST_CSTDFLOAT_FLOAT128_ASINH asinhq_patch244#define BOOST_CSTDFLOAT_FLOAT128_ACOSH acoshq_patch245#define BOOST_CSTDFLOAT_FLOAT128_ATANH atanhq_patch246#define BOOST_CSTDFLOAT_FLOAT128_TGAMMA tgammaq_patch247#endif // BOOST_CSTDFLOAT_BROKEN_FLOAT128_MATH_FUNCTIONS248// begin more functions249#define BOOST_CSTDFLOAT_FLOAT128_REMAINDER remainderq250#define BOOST_CSTDFLOAT_FLOAT128_REMQUO remquoq251#define BOOST_CSTDFLOAT_FLOAT128_FMA fmaq252#define BOOST_CSTDFLOAT_FLOAT128_FMAX fmaxq253#define BOOST_CSTDFLOAT_FLOAT128_FMIN fminq254#define BOOST_CSTDFLOAT_FLOAT128_FDIM fdimq255#define BOOST_CSTDFLOAT_FLOAT128_NAN nanq256//#define BOOST_CSTDFLOAT_FLOAT128_EXP2 exp2q257#define BOOST_CSTDFLOAT_FLOAT128_LOG2 log2q258#define BOOST_CSTDFLOAT_FLOAT128_LOG1P log1pq259#define BOOST_CSTDFLOAT_FLOAT128_CBRT cbrtq260#define BOOST_CSTDFLOAT_FLOAT128_HYPOT hypotq261#define BOOST_CSTDFLOAT_FLOAT128_ERF erfq262#define BOOST_CSTDFLOAT_FLOAT128_ERFC erfcq263#define BOOST_CSTDFLOAT_FLOAT128_LLROUND llroundq264#define BOOST_CSTDFLOAT_FLOAT128_LROUND lroundq265#define BOOST_CSTDFLOAT_FLOAT128_ROUND roundq266#define BOOST_CSTDFLOAT_FLOAT128_NEARBYINT nearbyintq267#define BOOST_CSTDFLOAT_FLOAT128_LLRINT llrintq268#define BOOST_CSTDFLOAT_FLOAT128_LRINT lrintq269#define BOOST_CSTDFLOAT_FLOAT128_RINT rintq270#define BOOST_CSTDFLOAT_FLOAT128_MODF modfq271#define BOOST_CSTDFLOAT_FLOAT128_SCALBLN scalblnq272#define BOOST_CSTDFLOAT_FLOAT128_SCALBN scalbnq273#define BOOST_CSTDFLOAT_FLOAT128_ILOGB ilogbq274#define BOOST_CSTDFLOAT_FLOAT128_LOGB logbq275#define BOOST_CSTDFLOAT_FLOAT128_NEXTAFTER nextafterq276//#define BOOST_CSTDFLOAT_FLOAT128_NEXTTOWARD nexttowardq277#define BOOST_CSTDFLOAT_FLOAT128_COPYSIGN copysignq278#define BOOST_CSTDFLOAT_FLOAT128_SIGNBIT signbitq279//#define BOOST_CSTDFLOAT_FLOAT128_FPCLASSIFY fpclassifyq280//#define BOOST_CSTDFLOAT_FLOAT128_ISFINITE isfiniteq281#define BOOST_CSTDFLOAT_FLOAT128_ISINF isinfq282#define BOOST_CSTDFLOAT_FLOAT128_ISNAN isnanq283//#define BOOST_CSTDFLOAT_FLOAT128_ISNORMAL isnormalq284//#define BOOST_CSTDFLOAT_FLOAT128_ISGREATER isgreaterq285//#define BOOST_CSTDFLOAT_FLOAT128_ISGREATEREQUAL isgreaterequalq286//#define BOOST_CSTDFLOAT_FLOAT128_ISLESS islessq287//#define BOOST_CSTDFLOAT_FLOAT128_ISLESSEQUAL islessequalq288//#define BOOST_CSTDFLOAT_FLOAT128_ISLESSGREATER islessgreaterq289//#define BOOST_CSTDFLOAT_FLOAT128_ISUNORDERED isunorderedq290// end more functions291#endif292 293// Implement quadruple-precision <cmath> functions in the namespace294// boost::math::cstdfloat::detail. Subsequently inject these into the295// std namespace via *using* directive.296 297// Begin with some forward function declarations. Also implement patches298// for compilers that have broken float128 exponential functions.299 300extern "C" int quadmath_snprintf(char*, std::size_t, const char*, ...) BOOST_MATH_NOTHROW;301 302extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_LDEXP(boost::math::cstdfloat::detail::float_internal128_t, int) BOOST_MATH_NOTHROW;303extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_FREXP(boost::math::cstdfloat::detail::float_internal128_t, int*) BOOST_MATH_NOTHROW;304extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_FABS(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;305extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_FLOOR(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;306extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_CEIL(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;307extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_SQRT(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;308extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_TRUNC(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;309extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_POW(boost::math::cstdfloat::detail::float_internal128_t, boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;310extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_LOG(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;311extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_LOG10(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;312extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_SIN(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;313extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_COS(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;314extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_TAN(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;315extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_ASIN(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;316extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_ACOS(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;317extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_ATAN(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;318extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_FMOD(boost::math::cstdfloat::detail::float_internal128_t, boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;319extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_ATAN2(boost::math::cstdfloat::detail::float_internal128_t, boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;320extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_LGAMMA(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;321 322// begin more functions323extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_REMAINDER(boost::math::cstdfloat::detail::float_internal128_t, boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;324extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_REMQUO(boost::math::cstdfloat::detail::float_internal128_t, boost::math::cstdfloat::detail::float_internal128_t, int*) BOOST_MATH_NOTHROW;325extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_FMA(boost::math::cstdfloat::detail::float_internal128_t, boost::math::cstdfloat::detail::float_internal128_t, boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;326extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_FMAX(boost::math::cstdfloat::detail::float_internal128_t, boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;327extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_FMIN(boost::math::cstdfloat::detail::float_internal128_t, boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;328extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_FDIM(boost::math::cstdfloat::detail::float_internal128_t, boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;329extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_NAN(const char*) BOOST_MATH_NOTHROW;330//extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_EXP2 (boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;331extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_LOG2(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;332extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_LOG1P(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;333extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_CBRT(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;334extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_HYPOT(boost::math::cstdfloat::detail::float_internal128_t, boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;335extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_ERF(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;336extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_ERFC(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;337extern "C" long long int BOOST_CSTDFLOAT_FLOAT128_LLROUND(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;338extern "C" long int BOOST_CSTDFLOAT_FLOAT128_LROUND(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;339extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_ROUND(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;340extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_NEARBYINT(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;341extern "C" long long int BOOST_CSTDFLOAT_FLOAT128_LLRINT(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;342extern "C" long int BOOST_CSTDFLOAT_FLOAT128_LRINT(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;343extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_RINT(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;344extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_MODF(boost::math::cstdfloat::detail::float_internal128_t, boost::math::cstdfloat::detail::float_internal128_t*) BOOST_MATH_NOTHROW;345extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_SCALBLN(boost::math::cstdfloat::detail::float_internal128_t, long int) BOOST_MATH_NOTHROW;346extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_SCALBN(boost::math::cstdfloat::detail::float_internal128_t, int) BOOST_MATH_NOTHROW;347extern "C" int BOOST_CSTDFLOAT_FLOAT128_ILOGB(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;348extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_LOGB(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;349extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_NEXTAFTER(boost::math::cstdfloat::detail::float_internal128_t, boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;350//extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_NEXTTOWARD (boost::math::cstdfloat::detail::float_internal128_t, boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;351extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_COPYSIGN(boost::math::cstdfloat::detail::float_internal128_t, boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;352extern "C" int BOOST_CSTDFLOAT_FLOAT128_SIGNBIT(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;353//extern "C" int BOOST_CSTDFLOAT_FLOAT128_FPCLASSIFY (boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;354//extern "C" int BOOST_CSTDFLOAT_FLOAT128_ISFINITE (boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;355extern "C" int BOOST_CSTDFLOAT_FLOAT128_ISINF(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;356extern "C" int BOOST_CSTDFLOAT_FLOAT128_ISNAN(boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;357//extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_ISNORMAL (boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;358//extern "C" int BOOST_CSTDFLOAT_FLOAT128_ISGREATER (boost::math::cstdfloat::detail::float_internal128_t, boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;359//extern "C" int BOOST_CSTDFLOAT_FLOAT128_ISGREATEREQUAL(boost::math::cstdfloat::detail::float_internal128_t, boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;360//extern "C" int BOOST_CSTDFLOAT_FLOAT128_ISLESS (boost::math::cstdfloat::detail::float_internal128_t, boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;361//extern "C" int BOOST_CSTDFLOAT_FLOAT128_ISLESSEQUAL (boost::math::cstdfloat::detail::float_internal128_t, boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;362//extern "C" int BOOST_CSTDFLOAT_FLOAT128_ISLESSGREATER(boost::math::cstdfloat::detail::float_internal128_t, boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;363//extern "C" int BOOST_CSTDFLOAT_FLOAT128_ISUNORDERED (boost::math::cstdfloat::detail::float_internal128_t, boost::math::cstdfloat::detail::float_internal128_t) BOOST_MATH_NOTHROW;364 // end more functions365 366#if !defined(BOOST_CSTDFLOAT_BROKEN_FLOAT128_MATH_FUNCTIONS)367 368extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_EXP(boost::math::cstdfloat::detail::float_internal128_t x) BOOST_MATH_NOTHROW;369extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_EXPM1(boost::math::cstdfloat::detail::float_internal128_t x) BOOST_MATH_NOTHROW;370extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_SINH(boost::math::cstdfloat::detail::float_internal128_t x) BOOST_MATH_NOTHROW;371extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_COSH(boost::math::cstdfloat::detail::float_internal128_t x) BOOST_MATH_NOTHROW;372extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_TANH(boost::math::cstdfloat::detail::float_internal128_t x) BOOST_MATH_NOTHROW;373extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_ASINH(boost::math::cstdfloat::detail::float_internal128_t x) BOOST_MATH_NOTHROW;374extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_ACOSH(boost::math::cstdfloat::detail::float_internal128_t x) BOOST_MATH_NOTHROW;375extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_ATANH(boost::math::cstdfloat::detail::float_internal128_t x) BOOST_MATH_NOTHROW;376extern "C" boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_TGAMMA(boost::math::cstdfloat::detail::float_internal128_t x) BOOST_MATH_NOTHROW;377 378#else // BOOST_CSTDFLOAT_BROKEN_FLOAT128_MATH_FUNCTIONS379 380// Forward declaration of the patched exponent function, exp(x).381inline boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_EXP(boost::math::cstdfloat::detail::float_internal128_t x);382 383inline boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_EXPM1(boost::math::cstdfloat::detail::float_internal128_t x)384{385 // Compute exp(x) - 1 for x small.386 387 // Use an order-12 Pade approximation of the exponential function.388 // PadeApproximant[Exp[x] - 1, {x, 0, 12, 12}].389 390 typedef boost::math::cstdfloat::detail::float_internal128_t float_type;391 392 float_type sum;393 394 if (x > BOOST_FLOAT128_C(0.693147180559945309417232121458176568075500134360255))395 {396 sum = ::BOOST_CSTDFLOAT_FLOAT128_EXP(x) - float_type(1);397 }398 else399 {400 const float_type x2 = (x * x);401 402 const float_type top = ((((( float_type(BOOST_FLOAT128_C(2.4087176110456818621091195109360728010934088788572E-13)) * x2403 + float_type(BOOST_FLOAT128_C(9.2735628025258751691201101171038802842096241836000E-10))) * x2404 + float_type(BOOST_FLOAT128_C(9.0806726962333369656024118266681195742980640005812E-07))) * x2405 + float_type(BOOST_FLOAT128_C(3.1055900621118012422360248447204968944099378881988E-04))) * x2406 + float_type(BOOST_FLOAT128_C(3.6231884057971014492753623188405797101449275362319E-02))) * x2407 + float_type(BOOST_FLOAT128_C(1.00000000000000000000000000000000000000000000000000000)))408 ;409 410 const float_type bot = (((((((((((( float_type(BOOST_FLOAT128_C(+7.7202487533515444298369215094104897470942592271063E-16)) * x411 + float_type(BOOST_FLOAT128_C(-1.2043588055228409310545597554680364005467044394286E-13))) * x412 + float_type(BOOST_FLOAT128_C(+9.2735628025258751691201101171038802842096241836000E-12))) * x413 + float_type(BOOST_FLOAT128_C(-4.6367814012629375845600550585519401421048120918000E-10))) * x414 + float_type(BOOST_FLOAT128_C(+1.6692413044546575304416198210786984511577323530480E-08))) * x415 + float_type(BOOST_FLOAT128_C(-4.5403363481166684828012059133340597871490320002906E-07))) * x416 + float_type(BOOST_FLOAT128_C(+9.5347063310450038138825324180015255530129672006102E-06))) * x417 + float_type(BOOST_FLOAT128_C(-1.5527950310559006211180124223602484472049689440994E-04))) * x418 + float_type(BOOST_FLOAT128_C(+1.9409937888198757763975155279503105590062111801242E-03))) * x419 + float_type(BOOST_FLOAT128_C(-1.8115942028985507246376811594202898550724637681159E-02))) * x420 + float_type(BOOST_FLOAT128_C(+1.1956521739130434782608695652173913043478260869565E-01))) * x421 + float_type(BOOST_FLOAT128_C(-0.50000000000000000000000000000000000000000000000000000))) * x422 + float_type(BOOST_FLOAT128_C(+1.00000000000000000000000000000000000000000000000000000)))423 ;424 425 sum = (x * top) / bot;426 }427 428 return sum;429}430inline boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_EXP(boost::math::cstdfloat::detail::float_internal128_t x)431{432 // Patch the expq() function for a subset of broken GCC compilers433 // like GCC 4.7, 4.8 on MinGW.434 435 typedef boost::math::cstdfloat::detail::float_internal128_t float_type;436 437 // Scale the argument x to the range (-ln2 < x < ln2).438 constexpr float_type one_over_ln2 = float_type(BOOST_FLOAT128_C(1.44269504088896340735992468100189213742664595415299));439 const float_type x_over_ln2 = x * one_over_ln2;440 441 int n;442 443 if (x != x)444 {445 // The argument is NaN.446 return std::numeric_limits<float_type>::quiet_NaN();447 }448 else if (::BOOST_CSTDFLOAT_FLOAT128_FABS(x) > BOOST_FLOAT128_C(+0.693147180559945309417232121458176568075500134360255))449 {450 // The absolute value of the argument exceeds ln2.451 n = static_cast<int>(::BOOST_CSTDFLOAT_FLOAT128_FLOOR(x_over_ln2));452 }453 else if (::BOOST_CSTDFLOAT_FLOAT128_FABS(x) < BOOST_FLOAT128_C(+0.693147180559945309417232121458176568075500134360255))454 {455 // The absolute value of the argument is less than ln2.456 n = 0;457 }458 else459 {460 // The absolute value of the argument is exactly equal to ln2 (in the sense of floating-point equality).461 return float_type(2);462 }463 464 // Check if the argument is very near an integer.465 const float_type floor_of_x = ::BOOST_CSTDFLOAT_FLOAT128_FLOOR(x);466 467 if (::BOOST_CSTDFLOAT_FLOAT128_FABS(x - floor_of_x) < float_type(BOOST_CSTDFLOAT_FLOAT128_EPS))468 {469 // Return e^n for arguments very near an integer.470 return boost::math::cstdfloat::detail::pown(BOOST_FLOAT128_C(2.71828182845904523536028747135266249775724709369996), static_cast<std::int_fast32_t>(floor_of_x));471 }472 473 // Compute the scaled argument alpha.474 const float_type alpha = x - (n * BOOST_FLOAT128_C(0.693147180559945309417232121458176568075500134360255));475 476 // Compute the polynomial approximation of expm1(alpha) and add to it477 // in order to obtain the scaled result.478 const float_type scaled_result = ::BOOST_CSTDFLOAT_FLOAT128_EXPM1(alpha) + float_type(1);479 480 // Rescale the result and return it.481 return scaled_result * boost::math::cstdfloat::detail::pown(float_type(2), n);482}483inline boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_SINH(boost::math::cstdfloat::detail::float_internal128_t x)484{485 // Patch the sinhq() function for a subset of broken GCC compilers486 // like GCC 4.7, 4.8 on MinGW.487 typedef boost::math::cstdfloat::detail::float_internal128_t float_type;488 489 // Here, we use the following:490 // Set: ex = exp(x)491 // Set: em1 = expm1(x)492 // Then493 // sinh(x) = (ex - 1/ex) / 2 ; for |x| >= 1494 // sinh(x) = (2em1 + em1^2) / (2ex) ; for |x| < 1495 496 const float_type ex = ::BOOST_CSTDFLOAT_FLOAT128_EXP(x);497 498 if (::BOOST_CSTDFLOAT_FLOAT128_FABS(x) < float_type(+1))499 {500 const float_type em1 = ::BOOST_CSTDFLOAT_FLOAT128_EXPM1(x);501 502 return ((em1 * 2) + (em1 * em1)) / (ex * 2);503 }504 else505 {506 return (ex - (float_type(1) / ex)) / 2;507 }508}509inline boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_COSH(boost::math::cstdfloat::detail::float_internal128_t x)510{511 // Patch the coshq() function for a subset of broken GCC compilers512 // like GCC 4.7, 4.8 on MinGW.513 typedef boost::math::cstdfloat::detail::float_internal128_t float_type;514 const float_type ex = ::BOOST_CSTDFLOAT_FLOAT128_EXP(x);515 return (ex + (float_type(1) / ex)) / 2;516}517inline boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_TANH(boost::math::cstdfloat::detail::float_internal128_t x)518{519 // Patch the tanhq() function for a subset of broken GCC compilers520 // like GCC 4.7, 4.8 on MinGW.521 typedef boost::math::cstdfloat::detail::float_internal128_t float_type;522 const float_type ex_plus = ::BOOST_CSTDFLOAT_FLOAT128_EXP(x);523 const float_type ex_minus = (float_type(1) / ex_plus);524 return (ex_plus - ex_minus) / (ex_plus + ex_minus);525}526inline boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_ASINH(boost::math::cstdfloat::detail::float_internal128_t x) BOOST_MATH_NOTHROW527{528 // Patch the asinh() function since quadmath does not have it.529 typedef boost::math::cstdfloat::detail::float_internal128_t float_type;530 return ::BOOST_CSTDFLOAT_FLOAT128_LOG(x + ::BOOST_CSTDFLOAT_FLOAT128_SQRT((x * x) + float_type(1)));531}532inline boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_ACOSH(boost::math::cstdfloat::detail::float_internal128_t x) BOOST_MATH_NOTHROW533{534 // Patch the acosh() function since quadmath does not have it.535 typedef boost::math::cstdfloat::detail::float_internal128_t float_type;536 const float_type zp(x + float_type(1));537 const float_type zm(x - float_type(1));538 539 return ::BOOST_CSTDFLOAT_FLOAT128_LOG(x + (zp * ::BOOST_CSTDFLOAT_FLOAT128_SQRT(zm / zp)));540}541inline boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_ATANH(boost::math::cstdfloat::detail::float_internal128_t x) BOOST_MATH_NOTHROW542{543 // Patch the atanh() function since quadmath does not have it.544 typedef boost::math::cstdfloat::detail::float_internal128_t float_type;545 return (::BOOST_CSTDFLOAT_FLOAT128_LOG(float_type(1) + x)546 - ::BOOST_CSTDFLOAT_FLOAT128_LOG(float_type(1) - x)) / 2;547}548inline boost::math::cstdfloat::detail::float_internal128_t BOOST_CSTDFLOAT_FLOAT128_TGAMMA(boost::math::cstdfloat::detail::float_internal128_t x) BOOST_MATH_NOTHROW549{550 // Patch the tgammaq() function for a subset of broken GCC compilers551 // like GCC 4.7, 4.8 on MinGW.552 typedef boost::math::cstdfloat::detail::float_internal128_t float_type;553 554 if (x > float_type(0))555 {556 return ::BOOST_CSTDFLOAT_FLOAT128_EXP(::BOOST_CSTDFLOAT_FLOAT128_LGAMMA(x));557 }558 else if (x < float_type(0))559 {560 // For x < 0, compute tgamma(-x) and use the reflection formula.561 const float_type positive_x = -x;562 float_type gamma_value = ::BOOST_CSTDFLOAT_FLOAT128_TGAMMA(positive_x);563 const float_type floor_of_positive_x = ::BOOST_CSTDFLOAT_FLOAT128_FLOOR(positive_x);564 565 // Take the reflection checks (slightly adapted) from <boost/math/gamma.hpp>.566 const bool floor_of_z_is_equal_to_z = (positive_x == ::BOOST_CSTDFLOAT_FLOAT128_FLOOR(positive_x));567 568 constexpr float_type my_pi = BOOST_FLOAT128_C(3.14159265358979323846264338327950288419716939937511);569 570 if (floor_of_z_is_equal_to_z)571 {572 const bool is_odd = ((std::int32_t(floor_of_positive_x) % std::int32_t(2)) != std::int32_t(0));573 574 return (is_odd ? -std::numeric_limits<float_type>::infinity()575 : +std::numeric_limits<float_type>::infinity());576 }577 578 const float_type sinpx_value = x * ::BOOST_CSTDFLOAT_FLOAT128_SIN(my_pi * x);579 580 gamma_value *= sinpx_value;581 582 const bool result_is_too_large_to_represent = ((::BOOST_CSTDFLOAT_FLOAT128_FABS(gamma_value) < float_type(1))583 && (((std::numeric_limits<float_type>::max)() * ::BOOST_CSTDFLOAT_FLOAT128_FABS(gamma_value)) < my_pi));584 585 if (result_is_too_large_to_represent)586 {587 const bool is_odd = ((std::int32_t(floor_of_positive_x) % std::int32_t(2)) != std::int32_t(0));588 589 return (is_odd ? -std::numeric_limits<float_type>::infinity()590 : +std::numeric_limits<float_type>::infinity());591 }592 593 gamma_value = -my_pi / gamma_value;594 595 if ((gamma_value > float_type(0)) || (gamma_value < float_type(0)))596 {597 return gamma_value;598 }599 else600 {601 // The value of gamma is too small to represent. Return 0.0 here.602 return float_type(0);603 }604 }605 else606 {607 // Gamma of zero is complex infinity. Return NaN here.608 return std::numeric_limits<float_type>::quiet_NaN();609 }610}611#endif // BOOST_CSTDFLOAT_BROKEN_FLOAT128_MATH_FUNCTIONS612 613// Define the quadruple-precision <cmath> functions in the namespace boost::math::cstdfloat::detail.614 615namespace boost {616 namespace math {617 namespace cstdfloat {618 namespace detail {619 inline boost::math::cstdfloat::detail::float_internal128_t ldexp(boost::math::cstdfloat::detail::float_internal128_t x, int n) { return ::BOOST_CSTDFLOAT_FLOAT128_LDEXP(x, n); }620 inline boost::math::cstdfloat::detail::float_internal128_t frexp(boost::math::cstdfloat::detail::float_internal128_t x, int* pn) { return ::BOOST_CSTDFLOAT_FLOAT128_FREXP(x, pn); }621 inline boost::math::cstdfloat::detail::float_internal128_t fabs(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_FABS(x); }622 inline boost::math::cstdfloat::detail::float_internal128_t abs(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_FABS(x); }623 inline boost::math::cstdfloat::detail::float_internal128_t floor(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_FLOOR(x); }624 inline boost::math::cstdfloat::detail::float_internal128_t ceil(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_CEIL(x); }625 inline boost::math::cstdfloat::detail::float_internal128_t sqrt(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_SQRT(x); }626 inline boost::math::cstdfloat::detail::float_internal128_t trunc(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_TRUNC(x); }627 inline boost::math::cstdfloat::detail::float_internal128_t exp(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_EXP(x); }628 inline boost::math::cstdfloat::detail::float_internal128_t expm1(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_EXPM1(x); }629 inline boost::math::cstdfloat::detail::float_internal128_t pow(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t a) { return ::BOOST_CSTDFLOAT_FLOAT128_POW(x, a); }630 inline boost::math::cstdfloat::detail::float_internal128_t pow(boost::math::cstdfloat::detail::float_internal128_t x, int a) { return ::BOOST_CSTDFLOAT_FLOAT128_POW(x, boost::math::cstdfloat::detail::float_internal128_t(a)); }631 inline boost::math::cstdfloat::detail::float_internal128_t log(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_LOG(x); }632 inline boost::math::cstdfloat::detail::float_internal128_t log10(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_LOG10(x); }633 inline boost::math::cstdfloat::detail::float_internal128_t sin(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_SIN(x); }634 inline boost::math::cstdfloat::detail::float_internal128_t cos(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_COS(x); }635 inline boost::math::cstdfloat::detail::float_internal128_t tan(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_TAN(x); }636 inline boost::math::cstdfloat::detail::float_internal128_t asin(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_ASIN(x); }637 inline boost::math::cstdfloat::detail::float_internal128_t acos(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_ACOS(x); }638 inline boost::math::cstdfloat::detail::float_internal128_t atan(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_ATAN(x); }639 inline boost::math::cstdfloat::detail::float_internal128_t sinh(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_SINH(x); }640 inline boost::math::cstdfloat::detail::float_internal128_t cosh(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_COSH(x); }641 inline boost::math::cstdfloat::detail::float_internal128_t tanh(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_TANH(x); }642 inline boost::math::cstdfloat::detail::float_internal128_t asinh(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_ASINH(x); }643 inline boost::math::cstdfloat::detail::float_internal128_t acosh(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_ACOSH(x); }644 inline boost::math::cstdfloat::detail::float_internal128_t atanh(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_ATANH(x); }645 inline boost::math::cstdfloat::detail::float_internal128_t fmod(boost::math::cstdfloat::detail::float_internal128_t a, boost::math::cstdfloat::detail::float_internal128_t b) { return ::BOOST_CSTDFLOAT_FLOAT128_FMOD(a, b); }646 inline boost::math::cstdfloat::detail::float_internal128_t atan2(boost::math::cstdfloat::detail::float_internal128_t y, boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_ATAN2(y, x); }647 inline boost::math::cstdfloat::detail::float_internal128_t lgamma(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_LGAMMA(x); }648 inline boost::math::cstdfloat::detail::float_internal128_t tgamma(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_TGAMMA(x); }649 // begin more functions650 inline boost::math::cstdfloat::detail::float_internal128_t remainder(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y) { return ::BOOST_CSTDFLOAT_FLOAT128_REMAINDER(x, y); }651 inline boost::math::cstdfloat::detail::float_internal128_t remquo(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y, int* z) { return ::BOOST_CSTDFLOAT_FLOAT128_REMQUO(x, y, z); }652 inline boost::math::cstdfloat::detail::float_internal128_t fma(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y, boost::math::cstdfloat::detail::float_internal128_t z) { return BOOST_CSTDFLOAT_FLOAT128_FMA(x, y, z); }653 654 inline boost::math::cstdfloat::detail::float_internal128_t fmax(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y) { return ::BOOST_CSTDFLOAT_FLOAT128_FMAX(x, y); }655 template <class T>656 inline typename std::enable_if<657 std::is_convertible<T, boost::math::cstdfloat::detail::float_internal128_t>::value658 && !std::is_same<T, boost::math::cstdfloat::detail::float_internal128_t>::value, boost::math::cstdfloat::detail::float_internal128_t>::type659 fmax(boost::math::cstdfloat::detail::float_internal128_t x, T y) { return ::BOOST_CSTDFLOAT_FLOAT128_FMAX(x, y); }660 template <class T>661 inline typename std::enable_if<662 std::is_convertible<T, boost::math::cstdfloat::detail::float_internal128_t>::value663 && !std::is_same<T, boost::math::cstdfloat::detail::float_internal128_t>::value, boost::math::cstdfloat::detail::float_internal128_t>::type664 fmax(T x, boost::math::cstdfloat::detail::float_internal128_t y) { return ::BOOST_CSTDFLOAT_FLOAT128_FMAX(x, y); }665 inline boost::math::cstdfloat::detail::float_internal128_t fmin(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y) { return ::BOOST_CSTDFLOAT_FLOAT128_FMIN(x, y); }666 template <class T>667 inline typename std::enable_if<668 std::is_convertible<T, boost::math::cstdfloat::detail::float_internal128_t>::value669 && !std::is_same<T, boost::math::cstdfloat::detail::float_internal128_t>::value, boost::math::cstdfloat::detail::float_internal128_t>::type670 fmin(boost::math::cstdfloat::detail::float_internal128_t x, T y) { return ::BOOST_CSTDFLOAT_FLOAT128_FMIN(x, y); }671 template <class T>672 inline typename std::enable_if<673 std::is_convertible<T, boost::math::cstdfloat::detail::float_internal128_t>::value674 && !std::is_same<T, boost::math::cstdfloat::detail::float_internal128_t>::value, boost::math::cstdfloat::detail::float_internal128_t>::type675 fmin(T x, boost::math::cstdfloat::detail::float_internal128_t y) { return ::BOOST_CSTDFLOAT_FLOAT128_FMIN(x, y); }676 677 inline boost::math::cstdfloat::detail::float_internal128_t fdim(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y) { return ::BOOST_CSTDFLOAT_FLOAT128_FDIM(x, y); }678 inline boost::math::cstdfloat::detail::float_internal128_t nanq(const char* x) { return ::BOOST_CSTDFLOAT_FLOAT128_NAN(x); }679 inline boost::math::cstdfloat::detail::float_internal128_t exp2(boost::math::cstdfloat::detail::float_internal128_t x)680 {681 return ::BOOST_CSTDFLOAT_FLOAT128_POW(boost::math::cstdfloat::detail::float_internal128_t(2), x);682 }683 inline boost::math::cstdfloat::detail::float_internal128_t log2(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_LOG2(x); }684 inline boost::math::cstdfloat::detail::float_internal128_t log1p(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_LOG1P(x); }685 inline boost::math::cstdfloat::detail::float_internal128_t cbrt(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_CBRT(x); }686 inline boost::math::cstdfloat::detail::float_internal128_t hypot(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y, boost::math::cstdfloat::detail::float_internal128_t z) { return ::BOOST_CSTDFLOAT_FLOAT128_SQRT(x*x + y * y + z * z); }687 inline boost::math::cstdfloat::detail::float_internal128_t hypot(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y) { return ::BOOST_CSTDFLOAT_FLOAT128_HYPOT(x, y); }688 template <class T>689 inline typename std::enable_if<690 std::is_convertible<T, boost::math::cstdfloat::detail::float_internal128_t>::value691 && !std::is_same<T, boost::math::cstdfloat::detail::float_internal128_t>::value, boost::math::cstdfloat::detail::float_internal128_t>::type692 hypot(boost::math::cstdfloat::detail::float_internal128_t x, T y) { return ::BOOST_CSTDFLOAT_FLOAT128_HYPOT(x, y); }693 template <class T>694 inline typename std::enable_if<695 std::is_convertible<T, boost::math::cstdfloat::detail::float_internal128_t>::value696 && !std::is_same<T, boost::math::cstdfloat::detail::float_internal128_t>::value, boost::math::cstdfloat::detail::float_internal128_t>::type697 hypot(T x, boost::math::cstdfloat::detail::float_internal128_t y) { return ::BOOST_CSTDFLOAT_FLOAT128_HYPOT(x, y); }698 699 700 inline boost::math::cstdfloat::detail::float_internal128_t erf(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_ERF(x); }701 inline boost::math::cstdfloat::detail::float_internal128_t erfc(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_ERFC(x); }702 inline long long int llround(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_LLROUND(x); }703 inline long int lround(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_LROUND(x); }704 inline boost::math::cstdfloat::detail::float_internal128_t round(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_ROUND(x); }705 inline boost::math::cstdfloat::detail::float_internal128_t nearbyint(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_NEARBYINT(x); }706 inline long long int llrint(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_LLRINT(x); }707 inline long int lrint(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_LRINT(x); }708 inline boost::math::cstdfloat::detail::float_internal128_t rint(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_RINT(x); }709 inline boost::math::cstdfloat::detail::float_internal128_t modf(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t* y) { return ::BOOST_CSTDFLOAT_FLOAT128_MODF(x, y); }710 inline boost::math::cstdfloat::detail::float_internal128_t scalbln(boost::math::cstdfloat::detail::float_internal128_t x, long int y) { return ::BOOST_CSTDFLOAT_FLOAT128_SCALBLN(x, y); }711 inline boost::math::cstdfloat::detail::float_internal128_t scalbn(boost::math::cstdfloat::detail::float_internal128_t x, int y) { return ::BOOST_CSTDFLOAT_FLOAT128_SCALBN(x, y); }712 inline int ilogb(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_ILOGB(x); }713 inline boost::math::cstdfloat::detail::float_internal128_t logb(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_LOGB(x); }714 inline boost::math::cstdfloat::detail::float_internal128_t nextafter(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y) { return ::BOOST_CSTDFLOAT_FLOAT128_NEXTAFTER(x, y); }715 inline boost::math::cstdfloat::detail::float_internal128_t nexttoward(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y) { return -(::BOOST_CSTDFLOAT_FLOAT128_NEXTAFTER(-x, -y)); }716 inline boost::math::cstdfloat::detail::float_internal128_t copysign BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y) { return ::BOOST_CSTDFLOAT_FLOAT128_COPYSIGN(x, y); }717 inline bool signbit BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_SIGNBIT(x); }718 inline int fpclassify BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x)719 {720 if (::BOOST_CSTDFLOAT_FLOAT128_ISNAN(x))721 return FP_NAN;722 else if (::BOOST_CSTDFLOAT_FLOAT128_ISINF(x))723 return FP_INFINITE;724 else if (x == BOOST_FLOAT128_C(0.0))725 return FP_ZERO;726 727 if (::BOOST_CSTDFLOAT_FLOAT128_FABS(x) < BOOST_CSTDFLOAT_FLOAT128_MIN)728 return FP_SUBNORMAL;729 else730 return FP_NORMAL;731 }732 inline bool isfinite BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x)733 {734 return !::BOOST_CSTDFLOAT_FLOAT128_ISNAN(x) && !::BOOST_CSTDFLOAT_FLOAT128_ISINF(x);735 }736 inline bool isinf BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_ISINF(x); }737 inline bool isnan BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x) { return ::BOOST_CSTDFLOAT_FLOAT128_ISNAN(x); }738 inline bool isnormal BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x) { return boost::math::cstdfloat::detail::fpclassify BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(x) == FP_NORMAL; }739 inline bool isgreater BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y)740 {741 if (isnan BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(x) || isnan BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(y))742 return false;743 return x > y;744 }745 template <class T>746 inline typename std::enable_if<747 std::is_convertible<T, boost::math::cstdfloat::detail::float_internal128_t>::value748 && !std::is_same<T, boost::math::cstdfloat::detail::float_internal128_t>::value, boost::math::cstdfloat::detail::float_internal128_t>::type749 isgreater BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, T y) { return isgreater BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(x, (boost::math::cstdfloat::detail::float_internal128_t)y); }750 template <class T>751 inline typename std::enable_if<752 std::is_convertible<T, boost::math::cstdfloat::detail::float_internal128_t>::value753 && !std::is_same<T, boost::math::cstdfloat::detail::float_internal128_t>::value, boost::math::cstdfloat::detail::float_internal128_t>::type754 isgreater BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(T x, boost::math::cstdfloat::detail::float_internal128_t y) { return isgreater BOOST_MATH_PREVENT_MACRO_SUBSTITUTION((boost::math::cstdfloat::detail::float_internal128_t)x, y); }755 756 inline bool isgreaterequal BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y)757 {758 if (isnan BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(x) || isnan BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(y))759 return false;760 return x >= y;761 }762 template <class T>763 inline typename std::enable_if<764 std::is_convertible<T, boost::math::cstdfloat::detail::float_internal128_t>::value765 && !std::is_same<T, boost::math::cstdfloat::detail::float_internal128_t>::value, boost::math::cstdfloat::detail::float_internal128_t>::type766 isgreaterequal BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, T y) { return isgreaterequal BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(x, (boost::math::cstdfloat::detail::float_internal128_t)y); }767 template <class T>768 inline typename std::enable_if<769 std::is_convertible<T, boost::math::cstdfloat::detail::float_internal128_t>::value770 && !std::is_same<T, boost::math::cstdfloat::detail::float_internal128_t>::value, boost::math::cstdfloat::detail::float_internal128_t>::type771 isgreaterequal BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(T x, boost::math::cstdfloat::detail::float_internal128_t y) { return isgreaterequal BOOST_MATH_PREVENT_MACRO_SUBSTITUTION((boost::math::cstdfloat::detail::float_internal128_t)x, y); }772 773 inline bool isless BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y)774 {775 if (isnan BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(x) || isnan BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(y))776 return false;777 return x < y;778 }779 template <class T>780 inline typename std::enable_if<781 std::is_convertible<T, boost::math::cstdfloat::detail::float_internal128_t>::value782 && !std::is_same<T, boost::math::cstdfloat::detail::float_internal128_t>::value, boost::math::cstdfloat::detail::float_internal128_t>::type783 isless BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, T y) { return isless BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(x, (boost::math::cstdfloat::detail::float_internal128_t)y); }784 template <class T>785 inline typename std::enable_if<786 std::is_convertible<T, boost::math::cstdfloat::detail::float_internal128_t>::value787 && !std::is_same<T, boost::math::cstdfloat::detail::float_internal128_t>::value, boost::math::cstdfloat::detail::float_internal128_t>::type788 isless BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(T x, boost::math::cstdfloat::detail::float_internal128_t y) { return isless BOOST_MATH_PREVENT_MACRO_SUBSTITUTION((boost::math::cstdfloat::detail::float_internal128_t)x, y); }789 790 791 inline bool islessequal BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y)792 {793 if (isnan BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(x) || isnan BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(y))794 return false;795 return x <= y;796 }797 template <class T>798 inline typename std::enable_if<799 std::is_convertible<T, boost::math::cstdfloat::detail::float_internal128_t>::value800 && !std::is_same<T, boost::math::cstdfloat::detail::float_internal128_t>::value, boost::math::cstdfloat::detail::float_internal128_t>::type801 islessequal BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, T y) { return islessequal BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(x, (boost::math::cstdfloat::detail::float_internal128_t)y); }802 template <class T>803 inline typename std::enable_if<804 std::is_convertible<T, boost::math::cstdfloat::detail::float_internal128_t>::value805 && !std::is_same<T, boost::math::cstdfloat::detail::float_internal128_t>::value, boost::math::cstdfloat::detail::float_internal128_t>::type806 islessequal BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(T x, boost::math::cstdfloat::detail::float_internal128_t y) { return islessequal BOOST_MATH_PREVENT_MACRO_SUBSTITUTION((boost::math::cstdfloat::detail::float_internal128_t)x, y); }807 808 809 inline bool islessgreater BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y)810 {811 if (isnan BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(x) || isnan BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(y))812 return false;813 return (x < y) || (x > y);814 }815 template <class T>816 inline typename std::enable_if<817 std::is_convertible<T, boost::math::cstdfloat::detail::float_internal128_t>::value818 && !std::is_same<T, boost::math::cstdfloat::detail::float_internal128_t>::value, boost::math::cstdfloat::detail::float_internal128_t>::type819 islessgreater BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, T y) { return islessgreater BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(x, (boost::math::cstdfloat::detail::float_internal128_t)y); }820 template <class T>821 inline typename std::enable_if<822 std::is_convertible<T, boost::math::cstdfloat::detail::float_internal128_t>::value823 && !std::is_same<T, boost::math::cstdfloat::detail::float_internal128_t>::value, boost::math::cstdfloat::detail::float_internal128_t>::type824 islessgreater BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(T x, boost::math::cstdfloat::detail::float_internal128_t y) { return islessgreater BOOST_MATH_PREVENT_MACRO_SUBSTITUTION((boost::math::cstdfloat::detail::float_internal128_t)x, y); }825 826 827 inline bool isunordered BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, boost::math::cstdfloat::detail::float_internal128_t y) { return ::BOOST_CSTDFLOAT_FLOAT128_ISNAN(x) || ::BOOST_CSTDFLOAT_FLOAT128_ISNAN(y); }828 template <class T>829 inline typename std::enable_if<830 std::is_convertible<T, boost::math::cstdfloat::detail::float_internal128_t>::value831 && !std::is_same<T, boost::math::cstdfloat::detail::float_internal128_t>::value, boost::math::cstdfloat::detail::float_internal128_t>::type832 isunordered BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(boost::math::cstdfloat::detail::float_internal128_t x, T y) { return isunordered BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(x, (boost::math::cstdfloat::detail::float_internal128_t)y); }833 template <class T>834 inline typename std::enable_if<835 std::is_convertible<T, boost::math::cstdfloat::detail::float_internal128_t>::value836 && !std::is_same<T, boost::math::cstdfloat::detail::float_internal128_t>::value, boost::math::cstdfloat::detail::float_internal128_t>::type837 isunordered BOOST_MATH_PREVENT_MACRO_SUBSTITUTION(T x, boost::math::cstdfloat::detail::float_internal128_t y) { return isunordered BOOST_MATH_PREVENT_MACRO_SUBSTITUTION((boost::math::cstdfloat::detail::float_internal128_t)x, y); }838 839 840 // end more functions841 }842 }843 }844} // boost::math::cstdfloat::detail845 846// We will now inject the quadruple-precision <cmath> functions847// into the std namespace. This is done via *using* directive.848namespace std849{850 using boost::math::cstdfloat::detail::ldexp;851 using boost::math::cstdfloat::detail::frexp;852 using boost::math::cstdfloat::detail::fabs;853 854#if !(defined(_GLIBCXX_USE_FLOAT128) && defined(__GNUC__) && (__GNUC__ >= 7))855#if (defined(__clang__) && !(!defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_FLOAT128))) || (__GNUC__ <= 6 && !defined(__clang__)) 856 // workaround for clang using libstdc++ and old GCC857 using boost::math::cstdfloat::detail::abs;858#endif859#endif860 861 using boost::math::cstdfloat::detail::floor;862 using boost::math::cstdfloat::detail::ceil;863 using boost::math::cstdfloat::detail::sqrt;864 using boost::math::cstdfloat::detail::trunc;865 using boost::math::cstdfloat::detail::exp;866 using boost::math::cstdfloat::detail::expm1;867 using boost::math::cstdfloat::detail::pow;868 using boost::math::cstdfloat::detail::log;869 using boost::math::cstdfloat::detail::log10;870 using boost::math::cstdfloat::detail::sin;871 using boost::math::cstdfloat::detail::cos;872 using boost::math::cstdfloat::detail::tan;873 using boost::math::cstdfloat::detail::asin;874 using boost::math::cstdfloat::detail::acos;875 using boost::math::cstdfloat::detail::atan;876 using boost::math::cstdfloat::detail::sinh;877 using boost::math::cstdfloat::detail::cosh;878 using boost::math::cstdfloat::detail::tanh;879 using boost::math::cstdfloat::detail::asinh;880 using boost::math::cstdfloat::detail::acosh;881 using boost::math::cstdfloat::detail::atanh;882 using boost::math::cstdfloat::detail::fmod;883 using boost::math::cstdfloat::detail::atan2;884 using boost::math::cstdfloat::detail::lgamma;885 using boost::math::cstdfloat::detail::tgamma;886 887 // begin more functions888 using boost::math::cstdfloat::detail::remainder;889 using boost::math::cstdfloat::detail::remquo;890 using boost::math::cstdfloat::detail::fma;891 using boost::math::cstdfloat::detail::fmax;892 using boost::math::cstdfloat::detail::fmin;893 using boost::math::cstdfloat::detail::fdim;894 using boost::math::cstdfloat::detail::nanq;895 using boost::math::cstdfloat::detail::exp2;896 using boost::math::cstdfloat::detail::log2;897 using boost::math::cstdfloat::detail::log1p;898 using boost::math::cstdfloat::detail::cbrt;899 using boost::math::cstdfloat::detail::hypot;900 using boost::math::cstdfloat::detail::erf;901 using boost::math::cstdfloat::detail::erfc;902 using boost::math::cstdfloat::detail::llround;903 using boost::math::cstdfloat::detail::lround;904 using boost::math::cstdfloat::detail::round;905 using boost::math::cstdfloat::detail::nearbyint;906 using boost::math::cstdfloat::detail::llrint;907 using boost::math::cstdfloat::detail::lrint;908 using boost::math::cstdfloat::detail::rint;909 using boost::math::cstdfloat::detail::modf;910 using boost::math::cstdfloat::detail::scalbln;911 using boost::math::cstdfloat::detail::scalbn;912 using boost::math::cstdfloat::detail::ilogb;913 using boost::math::cstdfloat::detail::logb;914 using boost::math::cstdfloat::detail::nextafter;915 using boost::math::cstdfloat::detail::nexttoward;916 using boost::math::cstdfloat::detail::copysign;917 using boost::math::cstdfloat::detail::signbit;918 using boost::math::cstdfloat::detail::fpclassify;919 using boost::math::cstdfloat::detail::isfinite;920 using boost::math::cstdfloat::detail::isinf;921 using boost::math::cstdfloat::detail::isnan;922 using boost::math::cstdfloat::detail::isnormal;923 using boost::math::cstdfloat::detail::isgreater;924 using boost::math::cstdfloat::detail::isgreaterequal;925 using boost::math::cstdfloat::detail::isless;926 using boost::math::cstdfloat::detail::islessequal;927 using boost::math::cstdfloat::detail::islessgreater;928 using boost::math::cstdfloat::detail::isunordered;929 // end more functions930 931} // namespace std932 933// We will now remove the preprocessor symbols representing quadruple-precision <cmath>934// functions from the preprocessor.935 936#undef BOOST_CSTDFLOAT_FLOAT128_LDEXP937#undef BOOST_CSTDFLOAT_FLOAT128_FREXP938#undef BOOST_CSTDFLOAT_FLOAT128_FABS939#undef BOOST_CSTDFLOAT_FLOAT128_FLOOR940#undef BOOST_CSTDFLOAT_FLOAT128_CEIL941#undef BOOST_CSTDFLOAT_FLOAT128_SQRT942#undef BOOST_CSTDFLOAT_FLOAT128_TRUNC943#undef BOOST_CSTDFLOAT_FLOAT128_EXP944#undef BOOST_CSTDFLOAT_FLOAT128_EXPM1945#undef BOOST_CSTDFLOAT_FLOAT128_POW946#undef BOOST_CSTDFLOAT_FLOAT128_LOG947#undef BOOST_CSTDFLOAT_FLOAT128_LOG10948#undef BOOST_CSTDFLOAT_FLOAT128_SIN949#undef BOOST_CSTDFLOAT_FLOAT128_COS950#undef BOOST_CSTDFLOAT_FLOAT128_TAN951#undef BOOST_CSTDFLOAT_FLOAT128_ASIN952#undef BOOST_CSTDFLOAT_FLOAT128_ACOS953#undef BOOST_CSTDFLOAT_FLOAT128_ATAN954#undef BOOST_CSTDFLOAT_FLOAT128_SINH955#undef BOOST_CSTDFLOAT_FLOAT128_COSH956#undef BOOST_CSTDFLOAT_FLOAT128_TANH957#undef BOOST_CSTDFLOAT_FLOAT128_ASINH958#undef BOOST_CSTDFLOAT_FLOAT128_ACOSH959#undef BOOST_CSTDFLOAT_FLOAT128_ATANH960#undef BOOST_CSTDFLOAT_FLOAT128_FMOD961#undef BOOST_CSTDFLOAT_FLOAT128_ATAN2962#undef BOOST_CSTDFLOAT_FLOAT128_LGAMMA963#undef BOOST_CSTDFLOAT_FLOAT128_TGAMMA964 965// begin more functions966#undef BOOST_CSTDFLOAT_FLOAT128_REMAINDER967#undef BOOST_CSTDFLOAT_FLOAT128_REMQUO968#undef BOOST_CSTDFLOAT_FLOAT128_FMA969#undef BOOST_CSTDFLOAT_FLOAT128_FMAX970#undef BOOST_CSTDFLOAT_FLOAT128_FMIN971#undef BOOST_CSTDFLOAT_FLOAT128_FDIM972#undef BOOST_CSTDFLOAT_FLOAT128_NAN973#undef BOOST_CSTDFLOAT_FLOAT128_EXP2974#undef BOOST_CSTDFLOAT_FLOAT128_LOG2975#undef BOOST_CSTDFLOAT_FLOAT128_LOG1P976#undef BOOST_CSTDFLOAT_FLOAT128_CBRT977#undef BOOST_CSTDFLOAT_FLOAT128_HYPOT978#undef BOOST_CSTDFLOAT_FLOAT128_ERF979#undef BOOST_CSTDFLOAT_FLOAT128_ERFC980#undef BOOST_CSTDFLOAT_FLOAT128_LLROUND981#undef BOOST_CSTDFLOAT_FLOAT128_LROUND982#undef BOOST_CSTDFLOAT_FLOAT128_ROUND983#undef BOOST_CSTDFLOAT_FLOAT128_NEARBYINT984#undef BOOST_CSTDFLOAT_FLOAT128_LLRINT985#undef BOOST_CSTDFLOAT_FLOAT128_LRINT986#undef BOOST_CSTDFLOAT_FLOAT128_RINT987#undef BOOST_CSTDFLOAT_FLOAT128_MODF988#undef BOOST_CSTDFLOAT_FLOAT128_SCALBLN989#undef BOOST_CSTDFLOAT_FLOAT128_SCALBN990#undef BOOST_CSTDFLOAT_FLOAT128_ILOGB991#undef BOOST_CSTDFLOAT_FLOAT128_LOGB992#undef BOOST_CSTDFLOAT_FLOAT128_NEXTAFTER993#undef BOOST_CSTDFLOAT_FLOAT128_NEXTTOWARD994#undef BOOST_CSTDFLOAT_FLOAT128_COPYSIGN995#undef BOOST_CSTDFLOAT_FLOAT128_SIGNBIT996#undef BOOST_CSTDFLOAT_FLOAT128_FPCLASSIFY997#undef BOOST_CSTDFLOAT_FLOAT128_ISFINITE998#undef BOOST_CSTDFLOAT_FLOAT128_ISINF999#undef BOOST_CSTDFLOAT_FLOAT128_ISNAN1000#undef BOOST_CSTDFLOAT_FLOAT128_ISNORMAL1001#undef BOOST_CSTDFLOAT_FLOAT128_ISGREATER1002#undef BOOST_CSTDFLOAT_FLOAT128_ISGREATEREQUAL1003#undef BOOST_CSTDFLOAT_FLOAT128_ISLESS1004#undef BOOST_CSTDFLOAT_FLOAT128_ISLESSEQUAL1005#undef BOOST_CSTDFLOAT_FLOAT128_ISLESSGREATER1006#undef BOOST_CSTDFLOAT_FLOAT128_ISUNORDERED1007// end more functions1008 1009#endif // Not BOOST_CSTDFLOAT_NO_LIBQUADMATH_SUPPORT (i.e., the user would like to have libquadmath support)1010 1011#endif // BOOST_MATH_CSTDFLOAT_CMATH_2014_02_15_HPP_1012 1013