mirror of
https://git.FreeBSD.org/src.git
synced 2025-02-02 17:08:56 +00:00
lib/msun: avoid referring to broken LDBL_MAX
LDBL_MAX is broken on i386: https://lists.freebsd.org/pipermail/freebsd-numerics/2012-September/000288.html Gcc has produced +Infinity for LDBL_MAX on i386 and amd64 with -m32 for some time, and newer versions of gcc are now warning that the "floating constant exceeds range of 'long double'". Avoid this by referring to half the value of LDBL_MAX instead. Reviewed by: bde Approved by: markj (mentor) Sponsored by: Dell EMC Isilon
This commit is contained in:
parent
b820ef458d
commit
9afac9fed9
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=322418
@ -307,7 +307,7 @@ clog_for_large_values(long double complex z)
|
||||
ay = t;
|
||||
}
|
||||
|
||||
if (ax > LDBL_MAX / 2)
|
||||
if (ax >= HALF_LDBL_MAX)
|
||||
return (CMPLXL(logl(hypotl(x / m_e, y / m_e)) + 1,
|
||||
atan2l(y, x)));
|
||||
|
||||
|
@ -272,6 +272,15 @@ do { \
|
||||
#define LD80C(m, ex, v) { .e = (v), }
|
||||
#endif
|
||||
|
||||
/*
|
||||
* XXX LDBL_MAX is broken on i386. If the precise value of LDBL_MAX is not
|
||||
* needed, this may be worked around by instead referring to a proxy, such
|
||||
* as HALF_LDBL_MAX, below. HALF_LDBL_MAX is approximately LDBL_MAX / 2,
|
||||
* actually just greater than. Note that 2 * HALF_LDBL_MAX will always
|
||||
* overflow to infinity, regardless of the precision and rounding modes.
|
||||
*/
|
||||
#define HALF_LDBL_MAX __CONCAT(__CONCAT(0x0.8p, LDBL_MAX_EXP), L)
|
||||
|
||||
#ifdef FLT_EVAL_METHOD
|
||||
/*
|
||||
* Attempt to get strict C99 semantics for assignment with non-C99 compilers.
|
||||
|
@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$");
|
||||
#pragma STDC CX_LIMITED_RANGE ON
|
||||
|
||||
/* We risk spurious overflow for components >= LDBL_MAX / (1 + sqrt(2)). */
|
||||
#define THRESH (LDBL_MAX / 2.414213562373095048801688724209698L)
|
||||
#define THRESH (HALF_LDBL_MAX / 1.207106781186547524400844362104849L)
|
||||
|
||||
long double complex
|
||||
csqrtl(long double complex z)
|
||||
|
Loading…
x
Reference in New Issue
Block a user