delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/06/12/10:15:34

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,T_TO_NO_BRKTS_FREEMAIL
X-Spam-Check-By: sourceware.org
Message-ID: <3113.95153.qm@web25508.mail.ukl.yahoo.com>
Date: Sat, 12 Jun 2010 14:13:30 +0000 (GMT)
From: Marco Atzeri <marco_atzeri AT yahoo DOT it>
Subject: Re: bug in NINT() in gfortran
To: cygwin AT cygwin DOT com
In-Reply-To: <4C13949C.40500@gmail.com>
MIME-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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

--- Sab 12/6/10, Dave Korn  ha scritto:

> Aagaard Jensen wrote:
> > The NINT() intrinsic in current gfortran under cygwin
> has a bug. Below follows:
>=20
> =A0 Thanks for the report.=A0 This appears to be the
> same or similar to a problem
> that's cropping up in the gfortran testsuite results (a
> FAIL in a test related
> to atan2) that as it happens I was just looking at
> yesterday, and my
> investigations so far suggest that it's actually a problem
> in the underlying
> maths functions in newlib.=A0 I'll reply to this thread
> when I figure out what's
> going on.
>=20
> =A0 =A0 cheers,
> =A0 =A0 =A0 DaveK
>=20

it seems a fault coming from newlib lround

#include <math.h>
#include <stdio.h>

int main (void) {
  double x =3D 132843.61283756854;
  int k,i;
  for( i=3D0 ; i<=3D7 ; i++ ) {
    k =3D (int) lround (x);
    printf ("%f %d \n", x, k);
    x =3D 10.0 *x;
  }
}

$ ./prova
132843.612838 132844
1328436.128376 -1596096578
13284361.283757 13284361
132843612.837569 132843613
1328436128.375685 1328436128
13284361283.756851 -2147483648
132843612837.568512 -2147483648
1328436128375.685059 -2147483648

It is curious that lroundf=20
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D33177
http://cygwin.com/ml/cygwin/2007-08/msg00642.html

has not such bug.

Marco






--
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