This is the mail archive of the
mailing list for the Cygwin project.
Re: fesetround problem
- From: Corinna Vinschen <corinna-cygwin at cygwin dot com>
- To: cygwin at cygwin dot com
- Date: Wed, 2 May 2012 09:45:02 +0200
- Subject: Re: fesetround problem
- References: <4FA0291E.email@example.com>
- Reply-to: cygwin at cygwin dot com
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.
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple