From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark H Weaver Newsgroups: gmane.lisp.guile.devel Subject: Re: [PATCH] New division operators, and optimization for fractions Date: Tue, 15 Feb 2011 06:43:10 -0500 Message-ID: <87ei795xrl.fsf@netris.org> References: <87sjvvv4md.fsf@yeeloong.netris.org> <87sjvpk2gk.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1297770218 31008 80.91.229.12 (15 Feb 2011 11:43:38 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 15 Feb 2011 11:43:38 +0000 (UTC) Cc: guile-devel@gnu.org To: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Feb 15 12:43:26 2011 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PpJJV-0000xt-UA for guile-devel@m.gmane.org; Tue, 15 Feb 2011 12:43:26 +0100 Original-Received: from localhost ([127.0.0.1]:45713 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PpJJU-0003UE-RO for guile-devel@m.gmane.org; Tue, 15 Feb 2011 06:43:24 -0500 Original-Received: from [140.186.70.92] (port=60165 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PpJJO-0003U9-Kh for guile-devel@gnu.org; Tue, 15 Feb 2011 06:43:19 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PpJJN-0005g1-Ic for guile-devel@gnu.org; Tue, 15 Feb 2011 06:43:18 -0500 Original-Received: from world.peace.net ([216.204.32.208]:51798) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PpJJM-0005fl-3y; Tue, 15 Feb 2011 06:43:16 -0500 Original-Received: from ip68-9-118-38.ri.ri.cox.net ([68.9.118.38] helo=freedomincluded) by world.peace.net with esmtpa (Exim 4.69) (envelope-from ) id 1PpJJH-0006Vu-DW; Tue, 15 Feb 2011 06:43:11 -0500 Original-Received: from mhw by freedomincluded with local (Exim 4.69) (envelope-from ) id 1PpJJG-0006Hp-Pw; Tue, 15 Feb 2011 06:43:10 -0500 In-Reply-To: <87sjvpk2gk.fsf@gnu.org> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?= =?utf-8?Q?s?= message of "Tue, 15 Feb 2011 11:38:03 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 216.204.32.208 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:11639 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable ludo@gnu.org (Ludovic Court=C3=A8s) writes: > This patch series seems to break compilation on i686-linux-gnu: > > http://hydra.nixos.org/build/913079 > > The relevant part of the log is: > > Running numbers.test > FAIL: numbers.test: Number-theoretic division: truncate/: mixed types: = (130.0 10/7) > FAIL: numbers.test: Number-theoretic division: truncate/: mixed types: = (130.0 -10/7) > FAIL: numbers.test: Number-theoretic division: truncate/: mixed types: = (-130.0 10/7) > FAIL: numbers.test: Number-theoretic division: truncate/: mixed types: = (-130.0 -10/7) The following patch should fix it. Best, Mark PS: Thanks for importing log1p so quickly! --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Use-trunc-in-scm_i_inexact_truncate_divide.patch Content-Description: Use trunc in scm_i_inexact_truncate_divide >From 4a9c388d3c837244e358916beda59d4634121723 Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Tue, 15 Feb 2011 06:10:06 -0500 Subject: [PATCH] Use trunc in scm_i_inexact_truncate_divide * libguile/numbers.c (scm_i_inexact_truncate_divide): Use trunc instead of floor and ceil. Important for consistency with scm_truncate_quotient and scm_truncate_remainder. --- libguile/numbers.c | 7 ++----- 1 files changed, 2 insertions(+), 5 deletions(-) diff --git a/libguile/numbers.c b/libguile/numbers.c index 59d8e74..7c4ea1b 100644 --- a/libguile/numbers.c +++ b/libguile/numbers.c @@ -2450,11 +2450,8 @@ scm_i_inexact_truncate_divide (double x, double y, SCM *qp, SCM *rp) scm_num_overflow (s_scm_truncate_divide); /* or return a NaN? */ else { - double q, r, q1; - /* FIXME: Use trunc, after it has been imported from gnulib */ - q1 = x / y; - q = (q1 >= 0) ? floor (q1) : ceil (q1); - r = x - q * y; + double q = trunc (x / y); + double r = x - q * y; *qp = scm_from_double (q); *rp = scm_from_double (r); } -- 1.7.1 --=-=-=--