This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix ctan, ctanh of subnormals in round-upwards mode (bug 14328)


On Sun, 8 Jul 2012, Adhemerval Zanella wrote:

> This patch is the same correction, but for IBM long double plus PPC
> ulps update. The correction relies on LDBL_EPSILON value, however
> for IBM long double, GCC builtin sets LDBL_EPSILON as LDBL_DENORM_MIN
> and thus the comparison:
> 
> if (fabsl (sinhrx) > fabsl (cosix) * LDBL_EPSILON)
> 
> Issues a FE_UNDERFLOW exception in the multiplication for some values.
> To fix this I used the constant 2^-106 as IBM long double epsilon
> (since IBM long double format target this precision). The ULPs for

Actually I noted that sqrt (epsilon) is really what's relevant here (just 
not convenient to write generically), so you might as well use DBL_EPSILON 
or 0xp1-53L or similar.

> +/* IBM long double GCC builtin sets LDBL_EPSILON == LDBL_DENORM_MIN  */
> +static const long double ldbl_eps = 1.232595164407831e-32; /* 2^-106  */

I'd say such constants are better written as hex floats, 0x1p-106L in this 
case (any floating-point constant where you intend an exact bit pattern 
for a particular floating-point format is better written as a hex float 
unless there is a short exact decimal expansion for it).

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]