chicken-hackers
[Top][All Lists]
Advanced

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

Re: [Chicken-hackers] numerator/denominator


From: Thomas Bushnell BSG
Subject: Re: [Chicken-hackers] numerator/denominator
Date: Tue, 04 Aug 2009 09:53:27 -0700

On Tue, 2009-08-04 at 01:45 -0700, Elf wrote:
> not all flonums are rational.
> chicken is perfectly compliant with r5 here: r5 does not require the entire
> numeric tower.

This is a common source of confusion with r5rs.  A Scheme is not
required to support the full numeric tower, but it is required to
support whichever numeric types it has completely.  

So it is perfectly ok for a Scheme to have no rationals at all, but it
is not ok to have rationals but fail to implement, say, "numerator" on
them.

A simple change to the manual would suffice.  Where it currently says
[6.2.5], "The procedures numerator, denominator ... are not
implemented", say "The procedures numerator and denominator are only
implemented for integers."

Or, alternatively, say in the manual that rational? is implemented
incorrectly, returning #t even though in fact there are no rationals in
Chicken Scheme, though I would not advocate that approach.

Or, alternatively, cause rational? to return #f for flonums, though I
would not advocate that approach.

(Often people confuse the general rule that flonums are usually rational
with the desirable implementation of exact rationals as pairs of
integers.  Chicken Scheme certainly has rationals, it just doesn't have
*exact* rationals.)

Thomas






reply via email to

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