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: Problem with lroundf()

I have just made a patch. The code in lroundf() was making a comparison between an int and a calculation using sizeof. This ended up being an unsigned comparison and in this case, the int value was < 1.

-- Jeff J.

Dave Korn wrote:
On 24 August 2007 17:16, François-Xavier Coudert wrote:

Hi all,

I think the following exhibits a bug in the lroundf() routine:

Gahh, it's entirely likely, we keep finding cruft and corner cases in the fp math. Cygwin's maths routines come from newlib; post redirected there and fups-to set.

$ cat a.c
#include <math.h>
#include <stdio.h>

int main (void) {
  printf ("%d\n", (int) lroundf(0.7));

$ gcc a.c && ./a.exe

The result of lroundf(0.7) should be 1, not 0. If lround() is used
instead of lroundf(), then it's working OK.

I didn't file a PR in bugzilla because the bug report instructions say
to send a mail to this list, but I can open one if need be.


Might get some spare time over the weekend to look at this with you, might not. Sorry I can't be more certain.


Unsubscribe info:
Problem reports:

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