beta 20.1 and 19 and 18 'rint' function with gcc is broken

Mumit Khan
Tue Dec 15 15:06:00 GMT 1998

Jeff Deifik <> writes:
> I have reported a bug with the math function rint.
> It is still not fixed with the latest beta-20.1

Hi Jeff,

I did take a look when you posted the test case the first time around, 
and I apologize for forgetting all about it.

The problem is the way rint is written in newlib -- it's using the old 
Sun code that I'm not too fond of. In fact, most of newlib's math functions
are not up to par if you're going to develop numerical code on ix86.

The simple fix, albeit awkward, is to declare the variable "w" volatile in
newlib/libm/math/s_rint.c and then the compiler wouldn't optimize away the
critical section at the end. Another quick fix is to use a an assembly
version of rint (see glibc2 sources) and use that for cygwin.

The real fix is to dump the math library and use one of the better tested
ones. Even glibc2 does quite a bit better than newlib as long as you steer
clear of some of the buggy inlined routines.

The *real* fix IMO is to dump newlib, but that's a whole different topic.


For help on using this list (especially unsubscribing), send a message to
"" with one line of text: "help".

More information about the Cygwin mailing list