emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#14905: closed (rationalize not returning the simpl


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#14905: closed (rationalize not returning the simplest rational)
Date: Sun, 21 Jul 2013 10:57:02 +0000

Your message dated Sun, 21 Jul 2013 06:56:03 -0400
with message-id <address@hidden>
and subject line Re: bug#14905: rationalize not returning the simplest rational
has caused the debbugs.gnu.org bug report #14905,
regarding rationalize not returning the simplest rational
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
14905: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=14905
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: rationalize not returning the simplest rational Date: Fri, 19 Jul 2013 13:18:41 +0200 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux)
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 = -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,

-- 
Göran Weinholt <address@hidden>
"On your own and though you feel alone you are alive.
Don't you know it's just another day." -- You Are Alive, Fragma

Attachment: pgpnOfOhf2geZ.pgp
Description: PGP signature


--- End Message ---
--- Begin Message --- Subject: Re: bug#14905: rationalize not returning the simplest rational Date: Sun, 21 Jul 2013 06:56:03 -0400 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)
Göran Weinholt <address@hidden> 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


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]