fesetround problem

David Matthews dm@prolingua.co.uk
Tue May 1 18:19:00 GMT 2012


fesetround seems to be broken in the current version of Cygwin.  It 
returns EINVAL for any argument other than FE_TONEAREST.  The following 
snippet works fine on Debian wheezy but shows a non-zero return in Cygwin.

#include <fenv.h>
#include <stdio.h>

int main()
{
     int r = fesetround(FE_TOWARDZERO);
     printf("fesetround returned %d.  Current rounding is %d\n",
            r, fegetround());
     return 0;
}

Browsing the CVS source it looks as though the problem is the line in 
fesetround in fenv.c that says:

   if (round & ~(FE_CW_ROUND_MASK >> FE_CW_PREC_SHIFT))

I think FE_CW_PREC_SHIFT should be FE_CW_ROUND_SHIFT to match fegetround 
above.

David

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list