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.bugs Subject: bug#14905: rationalize not returning the simplest rational Date: Sun, 21 Jul 2013 06:56:03 -0400 Message-ID: <87ob9w9o70.fsf@tines.lan> References: <87ehaun6ge.fsf@industria.weinholt.se> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1374404230 32085 80.91.229.3 (21 Jul 2013 10:57:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 21 Jul 2013 10:57:10 +0000 (UTC) Cc: 14905-done@debbugs.gnu.org To: =?UTF-8?Q?G=C3=B6ran?= Weinholt Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Sun Jul 21 12:57:10 2013 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1V0rK8-0004oG-IU for guile-bugs@m.gmane.org; Sun, 21 Jul 2013 12:57:08 +0200 Original-Received: from localhost ([::1]:54028 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V0rK8-0003xX-9u for guile-bugs@m.gmane.org; Sun, 21 Jul 2013 06:57:08 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48440) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V0rK4-0003xG-Fc for bug-guile@gnu.org; Sun, 21 Jul 2013 06:57:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V0rK3-0002sl-0T for bug-guile@gnu.org; Sun, 21 Jul 2013 06:57:04 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:46339) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V0rK2-0002sg-U9 for bug-guile@gnu.org; Sun, 21 Jul 2013 06:57:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1V0rK2-0004Q8-Js for bug-guile@gnu.org; Sun, 21 Jul 2013 06:57:02 -0400 Resent-From: Mark H Weaver Original-Sender: "Debbugs-submit" Resent-To: bug-guile@gnu.org Resent-Date: Sun, 21 Jul 2013 10:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 14905 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Mail-Followup-To: 14905@debbugs.gnu.org, mhw@netris.org, goran@weinholt.se Original-Received: via spool by 14905-done@debbugs.gnu.org id=D14905.137440418316713 (code D ref 14905); Sun, 21 Jul 2013 10:57:01 +0000 Original-Received: (at 14905-done) by debbugs.gnu.org; 21 Jul 2013 10:56:23 +0000 Original-Received: from localhost ([127.0.0.1]:40653 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1V0rJO-0004LU-MG for submit@debbugs.gnu.org; Sun, 21 Jul 2013 06:56:22 -0400 Original-Received: from world.peace.net ([96.39.62.75]:60160 ident=hope0) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1V0rJK-0004Ky-Ly for 14905-done@debbugs.gnu.org; Sun, 21 Jul 2013 06:56:19 -0400 Original-Received: from c-98-217-64-74.hsd1.ma.comcast.net ([98.217.64.74] helo=tines.lan) by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1V0rJD-00028b-QD; Sun, 21 Jul 2013 06:56:12 -0400 In-Reply-To: <87ehaun6ge.fsf@industria.weinholt.se> ("=?UTF-8?Q?G=C3=B6ran?= Weinholt"'s message of "Fri, 19 Jul 2013 13:18:41 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:7244 Archived-At: G=C3=B6ran Weinholt writes: > the procedure (rationalize x1 x2) from (rnrs) takes a number x1 and > returns the simplest rational that doesn't differ from x1 by more than > x2. The implementation in guile has this behavior: > > scheme@(guile-user)> (rationalize #e-0.67 1/4) > $1 =3D -2/3 > > The problem here is that -1/2 is simpler than -2/3 (since 1<2 and 2<3) > and it also doesn't differ from #e-0.67 by more than 1/4 (even though > the difference is larger than for -2/3, it is still less than 1/4). So > the result from the expression above should be -1/2. Fixed in 620c13e8fc02060e0af8fa38398ee4de745d41e9. Thanks! Mark