NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/49690: llrtint(x) broken for large values of x



>Number:         49690
>Category:       lib
>Synopsis:       llrtint(x) broken for large values of x
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Feb 24 12:20:00 +0000 2015
>Originator:     Tobias Nygren
>Release:        current and 6.1
>Organization:
>Environment:
tested on sparc64 and amd64
>Description:
llrint(3) seems to be broken for values larger than 2**51.

I tested the code below on Linux and FreeBSD x86_64 where it worked, but it fails on NetBSD.
>How-To-Repeat:
#include <stdio.h>
#include <math.h>
int main(void) {
  double x;
  int n;
  long long res;
  for (n = 0; n < 64; n++) {
    x = (double)(1LL<<n);
    res = llrint(x);
    if (res != x) {
     printf("llrint broken for x=2^%d: res = %lld, x = %.0f\n", n, res, x);
    }
  }
  return 0;
}

>Fix:
Didn't investigate.



Home | Main Index | Thread Index | Old Index