NetBSD Problem Report #46627
From www@NetBSD.org Mon Jun 25 04:44:47 2012
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
by www.NetBSD.org (Postfix) with ESMTP id A364A63BA27
for <gnats-bugs@gnats.NetBSD.org>; Mon, 25 Jun 2012 04:44:47 +0000 (UTC)
Message-Id: <20120625044445.DC22E63B85F@www.NetBSD.org>
Date: Mon, 25 Jun 2012 04:44:45 +0000 (UTC)
From: isaki@NetBSD.org
Reply-To: isaki@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: ceil() is broken on m68k FPE (FINT emulation is broken)
X-Send-Pr-Version: www-1.0
>Number: 46627
>Category: kern
>Synopsis: ceil() is broken on m68k FPE (FINT emulation is broken)
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Jun 25 04:45:00 +0000 2012
>Closed-Date: Tue Jun 26 02:04:58 +0000 2012
>Last-Modified: Wed Jul 04 20:35:02 +0000 2012
>Originator: Tetsuya Isaki
>Release: NetBSD-current/x68k
>Organization:
>Environment:
NetBSD xxxx 6.99.6 NetBSD 6.99.6 (GENERIC) #11: Mon May 7 22:47:21 JST 2012 xxxx@xxxx:xxxx/sys/arch/x68k/compile/GENERIC x68k
>Description:
On m68k FPE (= m68k without the FPU, such as XM6i emulator),
ceil() is broken in |x| < 1.
% uname -srm
NetBSD 6.99.6 x68k
% dmesg|grep FPU
X68030 (m68030 CPU/MMU, emulator FPU, 24MHz clock)
% cat a.c
#include <stdio.h>
#include <math.h>
int main()
{
double list[]={ -1.5, -1.1, -0.5, -0.1, 0, 0.1, 0.5, 1.1, 1.5, };
unsigned int i;
for (i = 0; i < sizeof(list)/sizeof(list[0]); i++) {
printf("ceil(%g) -> %g\n", list[i], ceil(list[i]));
}
return 0;
}
% gcc a.c -lm
% ./a.out
ceil(-1.5) -> -1
ceil(-1.1) -> -1
ceil(-0.5) -> -0.5
ceil(-0.1) -> -0
ceil(0) -> 0
ceil(0.1) -> 0
ceil(0.5) -> 1
ceil(1.1) -> 2
ceil(1.5) -> 2
%
ceil() calls FINT (in lib/libm/arch/m68k/s_ceil.S), and
FINT emulation in FPE does not consider FPCR round mode when
|x| < 1 and something is strange in sys/arch/m68k/fpe/fpu_int.c.
>How-To-Repeat:
See above.
>Fix:
I will fix it.
>Release-Note:
>Audit-Trail:
From: "Tetsuya Isaki" <isaki@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/46627 CVS commit: src/sys/arch/m68k/fpe
Date: Mon, 25 Jun 2012 04:52:23 +0000
Module Name: src
Committed By: isaki
Date: Mon Jun 25 04:52:23 UTC 2012
Modified Files:
src/sys/arch/m68k/fpe: fpu_int.c
Log Message:
Rewrite fpu_int().
Especially, remove the special treatment when |x| < 1
because it forgets to consider FPCR round mode.
See PR/46627 for the detail. Thanks Y.Sugahara for advice.
To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/m68k/fpe/fpu_int.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: isaki@NetBSD.org
State-Changed-When: Tue, 26 Jun 2012 02:04:58 +0000
State-Changed-Why:
Fixed.
From: "Julian Coleman" <jdc@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/46627 CVS commit: [netbsd-6] src/sys/arch/m68k/fpe
Date: Wed, 4 Jul 2012 20:30:00 +0000
Module Name: src
Committed By: jdc
Date: Wed Jul 4 20:30:00 UTC 2012
Modified Files:
src/sys/arch/m68k/fpe [netbsd-6]: fpu_int.c
Log Message:
Pull up revision 1.11 (requested by isaki in ticket #384).
Rewrite fpu_int().
Especially, remove the special treatment when |x| < 1
because it forgets to consider FPCR round mode.
See PR/46627 for the detail. Thanks Y.Sugahara for advice.
To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.10.8.1 src/sys/arch/m68k/fpe/fpu_int.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
>Unformatted:
(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-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.