Re: Use of C99 extra long double math functions after r236148

From: Steve Kargl <sgk_at_troutmask.apl.washington.edu>
Date: Mon, 28 May 2012 17:07:56 -0700
On Mon, May 28, 2012 at 06:44:42PM -0500, Stephen Montgomery-Smith wrote:
> On 05/28/2012 06:30 PM, Steve Kargl wrote:
> 
> >
> >>From clog.c in http://www.netlib.org/cephes/c9x-complex
> >
> >double complex
> >ccosh (z)
> >      double complex z;
> >{
> >   double complex w;
> >   double x, y;
> >
> >   x = creal(z);
> >   y = cimag(z);
> >   w = cosh (x) * cos (y)  +  (sinh (x) * sin (y)) * I;
> >   return (w);
> >}
> >
> >See math_private.h about the above.
> >
> 
> I looked in math_private.h - I presume you meant 
> lib/msun/src/math_private.h.  I wasn't able to find anything about ccosh 
> there.
> 
> I think that for a rough and ready ccosh, this is high enough quality 
> for a math/cephes port.

That's the problem.  It is not acceptable (imo).  The comment in
math_private.h that is relevant is

/*
 * Inline functions that can be used to construct complex values.
 *
 * The C99 standard intends x+I*y to be used for this, but x+I*y is
 * currently unusable in general since gcc introduces many overflow,
 * underflow, sign and efficiency bugs by rewriting I*y as
 * (0.0+I)*(y+0.0*I) and laboriously computing the full complex product.
 * In particular, I*Inf is corrupted to NaN+I*Inf, and I*-0 is corrupted
 * to -0.0+I*0.0.
 */

Those wrong +-0 mean you may up end up on the worng riemann sheet,
and that NaN propagates.

-- 
Steve
Received on Mon May 28 2012 - 22:07:56 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:27 UTC