Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm Sender: cygwin-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com From: Chris Faylor Date: Sun, 2 May 1999 19:32:03 -0400 To: cygwin AT sourceware DOT cygnus DOT com Subject: Re: (patch) newlib rint fix Message-ID: <19990502193202.B773@cygnus.com> References: <199905022045 DOT PAA27648 AT modi DOT xraylith DOT wisc DOT edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.3i In-Reply-To: <199905022045.PAA27648@modi.xraylith.wisc.edu>; from Mumit Khan on Sun, May 02, 1999 at 03:45:29PM -0500 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 . > > 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 > > * 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 AT sourceware DOT cygnus DOT com