This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: fesetround problem

On May  1 19:19, David Matthews wrote:
> 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.

Thanks for the report and the testcase.

Actually, the test for the input parameter should not shift it at all,
otherwise invalid input, for instance, 0xf0000000, would be treated as a
valid input of 0.  The fesetprec function had the same problem.  I fixed
that by explicitely only allowing the valid input range.

Thanks again,

Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]