delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/05/01/14:19:51

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=3.6 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
Message-ID: <4FA0291E.8040806@prolingua.co.uk>
Date: Tue, 01 May 2012 19:19:10 +0100
From: David Matthews <dm AT prolingua DOT co DOT uk>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120420 Thunderbird/12.0
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: fesetround problem
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019