NetBSD Problem Report #49690

From www@NetBSD.org  Tue Feb 24 12:17:04 2015
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 670ECA654B
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 24 Feb 2015 12:17:04 +0000 (UTC)
Message-Id: <20150224121703.59BFCA65B6@mollari.NetBSD.org>
Date: Tue, 24 Feb 2015 12:17:03 +0000 (UTC)
From: tnn@NetBSD.org
Reply-To: tnn@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: llrtint(x) broken for large values of x
X-Send-Pr-Version: www-1.0

>Number:         49690
>Category:       lib
>Synopsis:       llrint(x) broken for large values of x
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Feb 24 12:20:00 +0000 2015
>Closed-Date:    Thu Jul 09 06:31:06 +0000 2015
>Last-Modified:  Sun Nov 15 16:45:01 +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.

>Release-Note:

>Audit-Trail:

From: "Nathanial Sloss" <nat@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/49690 CVS commit: src/lib/libm/src
Date: Thu, 9 Jul 2015 06:17:13 +0000

 Module Name:	src
 Committed By:	nat
 Date:		Thu Jul  9 06:17:13 UTC 2015

 Modified Files:
 	src/lib/libm/src: lrint.c lrintf.c

 Log Message:
 Return x for >= DBL_FRACBITS in lrint.c.
 Return x for >= SNG_FRACBITS in lrintf.c

 Addresses PR lib/49690

 This commit was approved by christos@


 To generate a diff of this commit:
 cvs rdiff -u -r1.4 -r1.5 src/lib/libm/src/lrint.c
 cvs rdiff -u -r1.5 -r1.6 src/lib/libm/src/lrintf.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: nat@NetBSD.org
State-Changed-When: Thu, 09 Jul 2015 06:31:06 +0000
State-Changed-Why:
Test case in PR now works.  Thanks.


From: "Soren Jacobsen" <snj@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/49690 CVS commit: [netbsd-7] src/lib/libm/src
Date: Fri, 17 Jul 2015 03:44:09 +0000

 Module Name:	src
 Committed By:	snj
 Date:		Fri Jul 17 03:44:09 UTC 2015

 Modified Files:
 	src/lib/libm/src [netbsd-7]: lrint.c lrintf.c

 Log Message:
 Pull up following revision(s) (requested by nat in ticket #875):
 	lib/libm/src/lrint.c: revision 1.5
 	lib/libm/src/lrintf.c: revision 1.6
 Return x for >= DBL_FRACBITS in lrint.c.
 Return x for >= SNG_FRACBITS in lrintf.c
 Addresses PR lib/49690
 This commit was approved by christos@


 To generate a diff of this commit:
 cvs rdiff -u -r1.4 -r1.4.40.1 src/lib/libm/src/lrint.c
 cvs rdiff -u -r1.5 -r1.5.40.1 src/lib/libm/src/lrintf.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Soren Jacobsen" <snj@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/49690 CVS commit: [netbsd-5] src/lib/libm/src
Date: Sat, 7 Nov 2015 20:25:23 +0000

 Module Name:	src
 Committed By:	snj
 Date:		Sat Nov  7 20:25:23 UTC 2015

 Modified Files:
 	src/lib/libm/src [netbsd-5]: lrint.c lrintf.c

 Log Message:
 Pull up following revision(s) (requested by nat in ticket #1972):
 	lib/libm/src/lrintf.c: revision 1.6
 	lib/libm/src/lrint.c: revision 1.5
 Return x for >= DBL_FRACBITS in lrint.c.
 Return x for >= SNG_FRACBITS in lrintf.c
 Addresses PR lib/49690
 This commit was approved by christos@


 To generate a diff of this commit:
 cvs rdiff -u -r1.4 -r1.4.6.1 src/lib/libm/src/lrint.c
 cvs rdiff -u -r1.5 -r1.5.6.1 src/lib/libm/src/lrintf.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Manuel Bouyer" <bouyer@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/49690 CVS commit: [netbsd-6] src/lib/libm/src
Date: Sun, 15 Nov 2015 16:40:30 +0000

 Module Name:	src
 Committed By:	bouyer
 Date:		Sun Nov 15 16:40:30 UTC 2015

 Modified Files:
 	src/lib/libm/src [netbsd-6]: lrint.c lrintf.c

 Log Message:
 Pull up following revision(s) (requested by nat in ticket #1311):
 	lib/libm/src/lrintf.c: revision 1.6
 	lib/libm/src/lrint.c: revision 1.5
 Return x for >= DBL_FRACBITS in lrint.c.
 Return x for >= SNG_FRACBITS in lrintf.c
 Addresses PR lib/49690
 This commit was approved by christos@


 To generate a diff of this commit:
 cvs rdiff -u -r1.4 -r1.4.22.1 src/lib/libm/src/lrint.c
 cvs rdiff -u -r1.5 -r1.5.22.1 src/lib/libm/src/lrintf.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.