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: calling sincosf on subnormal argument is wrong


I filed  BZ# 14478.

http://sourceware.org/bugzilla/show_bug.cgi?id=14478

> Since the
> bugs arising from calling sincos are currently latent, no need to file
> them in Bugzilla before sending a patch

Ok, I will file them after a patch with optimized sincos.

--
Liubov

2012/8/16 Joseph S. Myers <joseph@codesourcery.com>:
> On Thu, 16 Aug 2012, Dmitrieva Liubov wrote:
>
>> The reason of fails is that the ccos, ccosh, cexp, csin, csinh
>> functions must not raise Underflow, because result is not subnormal.
>> But all they call to sincosf(x) on x=0x1p-149, that now raises
>> Underflow (new sincosf is correct here).
>> To fix the problems, the mentioned functions (ccos,etc) must not call
>> sincosf on subnormal argument.
>
> See what I said in
> <http://sourceware.org/ml/libc-alpha/2012-07/msg00080.html> about issues
> with rounding of results of sincos in directed rounding modes - the two
> issues (rounding yielding inaccurate results, and spurious underflows) are
> related, but the issues appeared to be latent.  (I mentioned ctan/ctanh
> there among the functions calling sincos internally, but actually it looks
> like they really will have an underflowing result when the input to sincos
> is subnormal, so the only issue for them may be missing underflow
> exceptions from sincos resulting in missing underflow exceptions from
> ctan/ctanh.)
>
> Note that *some* cases of the affected functions calling sincos *should*
> underflow - the final results may or may not be underflowing, but when
> they are, the exception should be raised.  But such cases (where all the
> intermediate calculations being exact means underflow exceptions are
> missing) would be separate bugs, already present in the current code, so
> could have bugs filed to be fixed separately.
>
> As usual, fixes should fix functions for all floating-point types at the
> same time - so change all of cexpf, cexp, cexpl in one patch to use (x, 1)
> instead of sincos (x), for example.  (This should be done for the least
> normal x as well as for subnormal x, e.g. fabs (x) <= DBL_MIN; whether sin
> (DBL_MIN) should raise underflow is architecture-dependent.)  Since the
> bugs arising from calling sincos are currently latent, no need to file
> them in Bugzilla before sending a patch - but the bugs of underflow
> exceptions being missing (when the final result still has at least one
> underflowing part) *should* be filed (as should the problem of most sin
> and sincos implementations not raising underflow when appropriate).
>
> --
> 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]