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: bug in NINT() in gfortran


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

> Aagaard Jensen wrote:
> > The NINT() intrinsic in current gfortran under cygwin
> has a bug. Below follows:
> 
> ? Thanks for the report.? 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.? I'll reply to this thread
> when I figure out what's
> going on.
> 
> ? ? cheers,
> ? ? ? DaveK
> 

it seems a fault coming from newlib lround

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

int main (void) {
  double x = 132843.61283756854;
  int k,i;
  for( i=0 ; i<=7 ; i++ ) {
    k = (int) lround (x);
    printf ("%f %d \n", x, k);
    x = 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 
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33177
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


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