1- // Copyright Naoki Shibata and contributors 2010 - 2024 .
1+ // Copyright Naoki Shibata and contributors 2010 - 2025 .
22// Distributed under the Boost Software License, Version 1.0.
33// (See accompanying file LICENSE.txt or copy at
44// http://www.boost.org/LICENSE_1_0.txt)
1313#include <string.h>
1414#endif
1515
16+
1617#ifndef M_PI
1718#define M_PI 3.141592653589793238462643383279502884
1819#endif
1920
21+ #ifndef M_PIf
22+ # define M_PIf ((float)M_PI)
23+ #endif
24+
2025#ifndef M_PIl
2126#define M_PIl 3.141592653589793238462643383279502884L
2227#endif
137142#define L2Lf 1.428606765330187045e-06f
138143
139144#define R_LN2f 1.442695040888963407359924681001892137426645954152985934135449406931f
140- #ifndef M_PIf
141- # define M_PIf ((float)M_PI)
142- #endif
145+
146+ // Overflow bounds
147+
148+ // - exp(x) overflows for x over (also used in pow)
149+ #define LOG_DBL_MAX 0x1.62e42fefa39efp+9 /* 709.782712893384 */
150+
151+ // Other bounds
152+
153+ // - log1p(f)(x) approximation holds up to x equals
154+ #define LOG1PF_BOUND 0x1.2ced32p+126 /* 1.0e+38 */
155+ #define LOG1P_BOUND 0x1.c7b1f3cac7433p+1019 /* 1.0e+307 */
143156
144157//
145158
@@ -183,17 +196,13 @@ typedef struct {
183196} Sleef_longdouble2 ;
184197#endif
185198
186- #if (defined (__GNUC__ ) || defined (__clang__ ) || defined( __INTEL_COMPILER ) ) && !defined(_MSC_VER )
199+ #if (defined (__GNUC__ ) || defined (__clang__ )) && !defined(_MSC_VER )
187200
188201#define LIKELY (condition ) __builtin_expect(!!(condition), 1)
189202#define UNLIKELY (condition ) __builtin_expect(!!(condition), 0)
190203#define RESTRICT __restrict__
191204
192- #ifndef __arm__
193205#define ALIGNED (x ) __attribute__((aligned(x)))
194- #else
195- #define ALIGNED (x )
196- #endif
197206
198207#if defined(SLEEF_GENHEADER )
199208
@@ -229,15 +238,15 @@ typedef struct {
229238#define SLEEF_INFINITYf __builtin_inff()
230239#define SLEEF_INFINITYl __builtin_infl()
231240
232- #if defined( __INTEL_COMPILER ) || defined (__clang__ )
241+ #if defined (__clang__ )
233242#define SLEEF_INFINITYq __builtin_inf()
234243#define SLEEF_NANq __builtin_nan("")
235244#else
236245#define SLEEF_INFINITYq __builtin_infq()
237246#define SLEEF_NANq (SLEEF_INFINITYq - SLEEF_INFINITYq)
238247#endif
239248
240- #elif defined(_MSC_VER ) // #if (defined (__GNUC__) || defined (__clang__) || defined(__INTEL_COMPILER) ) && !defined(_MSC_VER)
249+ #elif defined(_MSC_VER ) // #if (defined (__GNUC__) || defined (__clang__)) && !defined(_MSC_VER)
241250
242251#if defined(SLEEF_GENHEADER )
243252
@@ -249,6 +258,9 @@ typedef struct {
249258#else // #if defined(SLEEF_GENHEADER)
250259
251260#define INLINE __forceinline
261+ #ifdef CONST
262+ #undef CONST
263+ #endif
252264#define CONST
253265#ifndef SLEEF_STATIC_LIBS
254266#define EXPORT __declspec(dllexport)
@@ -265,7 +277,7 @@ typedef struct {
265277#define LIKELY (condition ) (condition)
266278#define UNLIKELY (condition ) (condition)
267279
268- #if (defined(__GNUC__ ) || defined(__CLANG__ )) && ( defined(__i386__ ) || defined( __x86_64__ ) ) && !defined(SLEEF_GENHEADER )
280+ #if (defined(__GNUC__ ) || defined(__CLANG__ )) && defined(__x86_64__ ) && !defined(SLEEF_GENHEADER )
269281#include <x86intrin.h>
270282#endif
271283
@@ -294,7 +306,7 @@ typedef struct {
294306#endif
295307#endif
296308
297- #endif // #elif defined(_MSC_VER) // #if (defined (__GNUC__) || defined (__clang__) || defined(__INTEL_COMPILER) ) && !defined(_MSC_VER)
309+ #endif // #elif defined(_MSC_VER) // #if (defined (__GNUC__) || defined (__clang__)) && !defined(_MSC_VER)
298310
299311#if !defined(__linux__ )
300312#define isinff (x ) ((x) == SLEEF_INFINITYf || (x) == -SLEEF_INFINITYf)
@@ -305,15 +317,9 @@ typedef struct {
305317
306318#endif // #ifndef __MISC_H__
307319
308- #ifdef ENABLE_AAVPCS
309- #define VECTOR_CC __attribute__((aarch64_vector_pcs))
310- #else
311- #define VECTOR_CC
312- #endif
313-
314320//
315321
316- #if defined (__GNUC__ ) && !defined( __INTEL_COMPILER )
322+ #if defined (__GNUC__ )
317323#pragma GCC diagnostic ignored "-Wpragmas"
318324#pragma GCC diagnostic ignored "-Wunknown-pragmas"
319325#if !defined (__clang__ )
0 commit comments