[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
four issues for R5RS meeting at Xerox PARC
Date: Mon, 18 May 92 13:42:28 -0400
From: "Chris Hanson" <cph@martigny.ai.mit.edu>
Date: Sun, 17 May 92 14:24:59 -0400
From: Aubrey Jaffer <jaffer@martigny.ai.mit.edu>
<1>
Section 6.5.3 should be clearer about what (/ 5 3) should do in an
integers only implementation and in the case of an implementation with
inexeacts but no rational numbers.
Implementations are encouraged, but not required, ... and to
implement the above procedures and the / procedure in such a way
that they always return exact results when given exact arguments.
If one of these procedures is unable to deliver an exact result when
given exact arguments, then it may either report a violation of an
implementation restriction or it may silently coerce its result to
an inexact number. Such a coercion may cause an error later.
As stated, (/ 5 3) should return 1 even if the implementation had
inexact numbers. It should say something about the Mathematically
expected result (as it does for the other functions in the paragraph
before the one I quoted). There was some discussion of this last year
but I can't find copies of the messages.
The IEEE standard has different wording for this paragraph that limits
the implementation options:
Implementations should support exact integers and exact rationals
of practically unlimited size and precision, and to implement
[sic] the above procedures and the / procedure in such a way that
they always return exact results when given exact arguments. If
one of these procedures is unable to deliver an exact result when
given exact arguments, then it may either report a violation of
an implementation restriction or it may silently coerce its
result to an inexact number. Such a coercion may cause an error
later.
The only difference between these paragraphs is the substitution of
the word "should" for the phrase "are encouraged, but not required,
to". This does not substantially change the meaning of the paragraph.
Other paragraphs in the same section in the IEEE standard use the
words "shall" and "must" to state requirements.
This requires an exact answer, an inexact answer, or violation of an
implementation restriction. Under no circumstances may `(/ 5 3)'
return `1'; it may return `5/3' or `1.' or some other inexact number,
or signal an error.
There is no prohibiting (/ 5 3) from returning 1. For the arithmatic
functions other than / the sentence from the paragraph previous to the
one quoted applies:
"Finally, the procedures listed below shall return an exact integer
result provided all the arguments are exact integers and the
mathematically expected result is representable as an exact integer
within the implementation:"
Were / part of the list referred to by this sentence then (/ 5 3)
would be restrained from returning 1. As it is, (/ 5 3) "should"
return an exact number.
SCM used to signal an error for (/ 5 3) which caused no end of
complaints from users. In a system without rational numbers the only
other possibility I read R4RS as allowing is an integer.