This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project. See the Cygwin home page for more information.
Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

(patch) newlib rint fix


We had discussed the problem with rint in the past, and I had suggested
a solution in that thread. Since it's still not fixed in the latest 
snapshots, here's a patch. This fixes the bug reported to the list by 
Jeff Deifik <jdeifik@weasel.com>.

   Subject: beta 20.1 and 19 and 18 'rint' function with gcc is broken
   URL: http://www.cygnus.com/ml/gnu-win32/1998-Dec/0381.html

Sun May  2 14:33:57 1999  Mumit Khan  <khan@xraylith.wisc.edu>
	
	* libm/common/s_rint.c (rint): Make w volatile to tell the 
	optimizer not to optimize it away.
	* libm/common/sf_rint.c (rintf): Likewise.

--- libm/common/s_rint.c.~1	Sun May  2 14:26:58 1999
+++ libm/common/s_rint.c	Sun May  2 14:27:10 1999
@@ -44,7 +44,8 @@ TWO52[2]={
 {
 	__int32_t i0,j0,sx;
 	__uint32_t i,i1;
-	double w,t;
+	volatile double w;
+	double t;
 	EXTRACT_WORDS(i0,i1,x);
 	sx = (i0>>31)&1;
 	j0 = ((i0>>20)&0x7ff)-0x3ff;
--- libm/common/sf_rint.c.~1	Sun May  2 14:27:15 1999
+++ libm/common/sf_rint.c	Sun May  2 14:27:28 1999
@@ -34,7 +34,8 @@ TWO23[2]={
 {
 	__int32_t i0,j0,sx;
 	__uint32_t i,i1;
-	float w,t;
+	volatile float w;
+	float t;
 	GET_FLOAT_WORD(i0,x);
 	sx = (i0>>31)&1;
 	j0 = ((i0>>23)&0xff)-0x7f;

Regards,
Mumit


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com