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]

Re: (patch) newlib rint fix


The last time this came up, I forwarded the problem and the test case
to the newlib mailing list.  There was a flurry of discussion about
"the right way" to fix this but, as often happens, this didn't coalesce
into a fix.

A technique similar to Mumit's patch below was raised and there were
some mild objections.  This was what was proposed instead:

>The fdlibm assume correct rounding according to the type throughout
>the entire set of functions.  I'd suggest to compile all fdlibm
>functions with --float-store which should have the same effect.  This
>avoids fixing one function after the other.

I'll ping the newlib maintainer again and see what he thinks about this
issue.

-chris

On Sun, May 02, 1999 at 03:45:29PM -0500, Mumit Khan wrote:
>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;

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