X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Wed, 2 May 2012 09:45:02 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: fesetround problem Message-ID: <20120502074502.GB2972@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <4FA0291E DOT 8040806 AT prolingua DOT co DOT uk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <4FA0291E.8040806@prolingua.co.uk> User-Agent: Mutt/1.5.21 (2010-09-15) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list 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 > #include > > 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 -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- 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