delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/06/15/05:30:25

Date: Sat, 15 Jun 2002 10:07:21 +0100
From: "Richard Dawe" <rich AT phekda DOT freeserve DOT co DOT uk>
Sender: rich AT phekda DOT freeserve DOT co DOT uk
To: djgpp-workers AT delorie DOT com
X-Mailer: Emacs 21.3.50 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.6
Subject: Patch for pow bugs
Message-Id: <E17J9QT-0000QQ-00@phekda.freeserve.co.uk>
Reply-To: djgpp-workers AT delorie DOT com

Hello.

Below is a patch for the pow bugs with a changelog entry.

I tested Eric's patch with my Athlon 850MHz and I now get consistent
results between the two implementations of pow. Also I reran
the Cygnus test suite and I get the same results as without the patch.

OK to commit?

Thanks, bye, Rich =]

Index: src/docs/kb/wc204.txi
===================================================================
RCS file: /cvs/djgpp/djgpp/src/docs/kb/wc204.txi,v
retrieving revision 1.114
diff -p -c -3 -r1.114 wc204.txi
*** src/docs/kb/wc204.txi	11 Jun 2002 08:27:27 -0000	1.114
--- src/docs/kb/wc204.txi	15 Jun 2002 08:59:03 -0000
*************** The function @code{fchown} was added.
*** 748,750 ****
--- 748,759 ----
  A bug was fixed in the File System Extensions mechanism that could be
  exposed in environments where it is possible to have large numbers of
  file descriptors (> 256) and low memory.
+ 
+ @findex pow
+ A bug was fixed in the function @code{pow} in @file{libm.a}.
+ Previously @code{pow(x,y)} returned 0 when @code{x} was very close to
+ -1.0 and @code{y} was very large. 
+ 
+ A bug was fixed in the function @code{pow} in @file{libc.a}.
+ Previously @code{pow} may have failed for negative numbers with
+ a large magnitude.
Index: src/libc/ansi/math/pow.S
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/ansi/math/pow.S,v
retrieving revision 1.7
diff -p -c -3 -r1.7 pow.S
*** src/libc/ansi/math/pow.S	4 Aug 1999 19:58:21 -0000	1.7
--- src/libc/ansi/math/pow.S	15 Jun 2002 08:59:04 -0000
*************** xltz:
*** 146,156 ****
  	jmp	badresult
  
  yisint:
! 	fistl	8(%esp)
  	fxch	%st(1)
  	fyl2x
  	call	Lpow2
! 	andl	$1,8(%esp)
  	jz	yeven
  	fchs
  yeven:
--- 146,157 ----
  	jmp	badresult
  
  yisint:
! 	fld	%st
! 	fistpq	(%esp)
  	fxch	%st(1)
  	fyl2x
  	call	Lpow2
! 	andl	$1,(%esp)
  	jz	yeven
  	fchs
  yeven:
Index: src/libm/math/e_pow.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libm/math/e_pow.c,v
retrieving revision 1.2
diff -p -c -3 -r1.2 e_pow.c
*** src/libm/math/e_pow.c	16 Mar 2002 13:32:53 -0000	1.2
--- src/libm/math/e_pow.c	15 Jun 2002 08:59:10 -0000
*************** ivln2_l  =  1.92596299112661746887e-08; 
*** 197,203 ****
  	    if(ix>0x3ff00000) return (hy>0)? huge*huge:tiny*tiny;
  	/* now |1-x| is tiny <= 2**-20, suffice to compute 
  	   log(x) by x-x^2/2+x^3/3-x^4/4 */
! 	    t = x-1;		/* t has 20 trailing zeros */
  	    w = (t*t)*(0.5-t*(0.3333333333333333333333-t*0.25));
  	    u = ivln2_h*t;	/* ivln2_h has 21 sig. bits */
  	    v = t*ivln2_l-w*ivln2;
--- 197,203 ----
  	    if(ix>0x3ff00000) return (hy>0)? huge*huge:tiny*tiny;
  	/* now |1-x| is tiny <= 2**-20, suffice to compute 
  	   log(x) by x-x^2/2+x^3/3-x^4/4 */
! 	    t = ax-1;		/* t has 20 trailing zeros */
  	    w = (t*t)*(0.5-t*(0.3333333333333333333333-t*0.25));
  	    u = ivln2_h*t;	/* ivln2_h has 21 sig. bits */
  	    v = t*ivln2_l-w*ivln2;

- Raw text -


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