www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/06/28/08:07:36

Date: Thu, 28 Jun 2001 15:04:20 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
Message-Id: <200106281204.PAA13302@is.elta.co.il>
To: JT Williams <jeffw AT darwin DOT sfbr DOT org>
CC: djgpp-workers AT delorie DOT com
In-reply-to: <20010626135149.A6641@kendall.sfbr.org> (message from JT Williams
on Tue, 26 Jun 2001 13:51:49 -0500)
Subject: Re: signed/unsigned in libm
References: <20010620135643 DOT B3036 AT kendall DOT sfbr DOT org> <200106201947 DOT VAA23224 AT father DOT ludd DOT luth DOT se> <20010626135149 DOT A6641 AT kendall DOT sfbr DOT org>
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> Here are the casts I came up with.

Thanks!

This one worries me:

> diff -u -3 -r1.1 ef_j0.c
> --- ef_j0.c	1998/02/07 14:13:26	1.1
> +++ ef_j0.c	2001/06/26 18:40:12
> @@ -74,7 +74,7 @@
>  	 * j0(x) = 1/sqrt(pi) * (P(0,x)*cc - Q(0,x)*ss) / sqrt(x)
>  	 * y0(x) = 1/sqrt(pi) * (P(0,x)*ss + Q(0,x)*cc) / sqrt(x)
>  	 */
> -		if(ix>0x80000000U) z = (invsqrtpi*cc)/__ieee754_sqrtf(x);
> +		if((__uint32_t)ix>0x80000000U) z = (invsqrtpi*cc)/__ieee754_sqrtf(x);

(there are a few more like this one).  0x80000000U has its MSB set,
and since ix is a signed int, it can never be larger that this number.
So what does this code want to do?

According to the algorithm description in e_j0.c, the double-precision
version of the same function, this snippet is for the case where the
argument is in the [2..Inf] range.  So it looks like a bug to me.
Could someone please test arguments in that range, step with a
debugger into the function, and see what's going on?

The rest of the changes look fine to me.  Of course, we need to run
the Cygnus test suite to make sure there are no regressions.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019