unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Mark H Weaver <mhw@netris.org>
To: "Göran Weinholt" <goran@weinholt.se>
Cc: 14905-done@debbugs.gnu.org
Subject: bug#14905: rationalize not returning the simplest rational
Date: Sun, 21 Jul 2013 06:56:03 -0400	[thread overview]
Message-ID: <87ob9w9o70.fsf@tines.lan> (raw)
In-Reply-To: <87ehaun6ge.fsf@industria.weinholt.se> ("Göran Weinholt"'s message of "Fri, 19 Jul 2013 13:18:41 +0200")

Göran Weinholt <goran@weinholt.se> 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 = -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





      reply	other threads:[~2013-07-21 10:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-19 11:18 bug#14905: rationalize not returning the simplest rational Göran Weinholt
2013-07-21 10:56 ` Mark H Weaver [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ob9w9o70.fsf@tines.lan \
    --to=mhw@netris.org \
    --cc=14905-done@debbugs.gnu.org \
    --cc=goran@weinholt.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).