From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?Q?G=C3=B6ran?= Weinholt Newsgroups: gmane.lisp.guile.bugs Subject: bug#14905: rationalize not returning the simplest rational Date: Fri, 19 Jul 2013 13:18:41 +0200 Message-ID: <87ehaun6ge.fsf@industria.weinholt.se> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Trace: ger.gmane.org 1374233692 22598 80.91.229.3 (19 Jul 2013 11:34:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 19 Jul 2013 11:34:52 +0000 (UTC) To: 14905@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Fri Jul 19 13:34:53 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 1V08xX-0005R6-VJ for guile-bugs@m.gmane.org; Fri, 19 Jul 2013 13:34:52 +0200 Original-Received: from localhost ([::1]:49138 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V08xX-00084q-4p for guile-bugs@m.gmane.org; Fri, 19 Jul 2013 07:34:51 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48562) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V08xS-00084h-I3 for bug-guile@gnu.org; Fri, 19 Jul 2013 07:34:47 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V08xR-0005Sd-KZ for bug-guile@gnu.org; Fri, 19 Jul 2013 07:34:46 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:42598) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V08p0-0002oe-On for bug-guile@gnu.org; Fri, 19 Jul 2013 07:26:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1V08oz-0007G0-Vo for bug-guile@gnu.org; Fri, 19 Jul 2013 07:26:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?G=C3=B6ran?= Weinholt Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Fri, 19 Jul 2013 11:26:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 14905 X-GNU-PR-Package: guile X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.137423310927780 (code B ref -1); Fri, 19 Jul 2013 11:26:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 19 Jul 2013 11:25:09 +0000 Original-Received: from localhost ([127.0.0.1]:36913 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1V08o9-0007Dy-Bp for submit@debbugs.gnu.org; Fri, 19 Jul 2013 07:25:09 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:43563) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1V08o6-0007DT-B5 for submit@debbugs.gnu.org; Fri, 19 Jul 2013 07:25:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V08nz-0001yg-Pg for submit@debbugs.gnu.org; Fri, 19 Jul 2013 07:25:01 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:48096) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V08nz-0001yR-KY for submit@debbugs.gnu.org; Fri, 19 Jul 2013 07:24:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45253) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V08nw-00072D-MU for bug-guile@gnu.org; Fri, 19 Jul 2013 07:24:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V08iE-0007up-Mq for bug-guile@gnu.org; Fri, 19 Jul 2013 07:19:07 -0400 Original-Received: from iustitia.weinholt.se ([2a02:28f0:0:a::7dce:e5a8]:36165) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V08iE-0007qb-9i for bug-guile@gnu.org; Fri, 19 Jul 2013 07:19:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=weinholt.se; s=iustitia2012; h=Content-Type:MIME-Version:Message-ID:Date:Subject:To:From; bh=zhHgLcl6SGeDehNSgrQ/5bSYkciegM6T0/kjCjgmcfg=; b=clL7tB+VjT8sFs9WJFFHf6lwdmXHRdYCedtye5ufcNZve3PGxFvub+R1yE8Huyir9DtpV6Pyqf91WUF1Z2WWCSwQ7NopNL4ZUdFuVfIJrwobU0oudSm6FKliLcMJL9A8KKk4ARyzgEyvq5OgIe6qjwJMCeG0B01UC1WZOgUV2BxMtySqMKMcEomiEDKaNmodmZ5ZkFJXf9cA2u4SlwfKYmKEFci+binV0G9OAtvZClxBL9BZS8A6CyjYFwD2pwqB1ymL+bXESt9EdcKyFGa9NSJvRzhjReUGm6thisvJBKcMTDBA5UTA8V10nJwN171R90bJbfrSvGUSL/KQicWSOA==; Original-Received: from uucp by iustitia.weinholt.se with local-bsmtp (Exim 4.72) (envelope-from ) id 1V08i6-0002vN-Er; Fri, 19 Jul 2013 13:18:54 +0200 Original-Received: from weinholt by industria with local (Exim 4.80) (envelope-from ) id 1V08hz-0001rv-9t; Fri, 19 Jul 2013 13:18:47 +0200 X-Hashcash: 1:20:130719:bug-guile@gnu.org::iZc0Aau6GotcKHCF:000000000000000000000000000000000000000000009bMv User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). 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:7240 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello schemers, 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. Tested with Guile 2.0.9.40-824b-dirty. Regards, =2D-=20 G=C3=B6ran Weinholt "On your own and though you feel alone you are alive. Don't you know it's just another day." -- You Are Alive, Fragma --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQIcBAEBCgAGBQJR6SCSAAoJEOM+YaLpuMOiMLMP/j5/BOgsTbACjvjjrOJwhhmg zdoRNZjNgsYIjYPoGakVEjwtMhXe8BHYENtVesFJEUyWS0uCiq9z2Zn3PIAZtoIe z8ctfib+bE6E89r7ol2zA7eZQTAeBevzyC8D6Oesko7lOvMOwADCScrbPpMCVNqi JebYRZiXGysRjIjfoG/itxQ/SVx+cmOXjGknHTtrf92o1MKOx5iQelks+D1dhvSC X3fnqhZ/Q71Y2uY/NajjOEsTptGQvrFDe9GI3PDS3HvjxHFjhwpG8Eipwgaeo/I1 XsWVBLDo5+zTHnXppxs2fijw8SeNhISKSOMPmdiWELBBRI4kQuLlBanmG98FSdY6 q+P9XDeutCq5CZpT5PLDET7INEgXP2GJ6/SShNcAlKrtIYUS/aj8Mw21+ocdB8yf aeDVDdxTY4nL98QdbpLkJvQFuQmNu0N1yCdOUikHAB0jlPFT7pcedH8/83fSqTL9 +Nkv6IH2s6M3dWAbo/HlUyQ5hxSEinFjXDiBQjU/ooj2mMgyiquwe8+5YZ9q+rGG KVoB5DSOiw0MEJ2dRCI1ZmMS5SZvtEZbGgQt62K68icGyNBFGq7TeG9Rmxehr7eM esS2YaguNLJ+faXnLyS8Lmt8lDRS2i2DPmvHfX07Rb0VRETfmvXACLP7nmGzLcZZ WVHbEA831Z1yHx/kgL/4 =Q1wv -----END PGP SIGNATURE----- --=-=-=--