29
78
Fork
You've already forked r7rs
2

Contradictory definition of integers #376

Open
opened 2026年07月12日 05:06:40 +02:00 by phm · 2 comments
Member
Copy link

Infinity is described as real but not rational. However, R7RS defines (integer? obj) on inexact reals to be true iff (= x (round x)). Since (round +inf.0) => +inf.0, (integer? +inf.0) => #t. This contradicts the example (rational? -inf.0) => #f and the fact that integers are a subset of the rationals.

This should be changed to the R6RS definition in terms of the denominator, which does not have this issue.

Infinity is described as real but not rational. However, R7RS defines `(integer? obj)` on inexact reals to be true iff `(= x (round x))`. Since `(round +inf.0) => +inf.0`, `(integer? +inf.0) => #t`. This contradicts the example `(rational? -inf.0) => #f` and the fact that integers are a subset of the rationals. This should be changed to the R6RS definition in terms of the denominator, which does not have this issue.
Member
Copy link

I'd argue that (integer? +inf.0) => #f is implied already due to integers being rational, as you said. Since the infinity isn't rational, it can't possibly be an integer, even if (= x (round x)).

The spec language is unclear though, so I agree that it should be changed a bit. Maybe add an additional clause that the inexact real must also be rational.

I'd argue that `(integer? +inf.0) => #f` is implied already due to integers being rational, as you said. Since the infinity isn't rational, it can't possibly be an integer, even if `(= x (round x))`. The spec language is unclear though, so I agree that it should be changed a bit. Maybe add an additional clause that the inexact real must also be rational.

Agreed on both points. I'll make a.proposed R7RS-small erratum. At least Chibi will need fixing.

Agreed on both points. I'll make a.proposed R7RS-small erratum. At least Chibi will need fixing.
Sign in to join this conversation.
No Branch/Tag specified
main
pages
proc-draft
c-trichotomy
global-id-prop-ref
allow-van-tonder-like-expanders
No results found.
Labels
Clear labels
Batteries
Issues for the Batteries volume of the report, providing a standard library
Cleanup
Issues where inconsistencies or other infelicities have arisen
Consent Docket
Items which will be automatically be given a certain resolution if no objection is made by a certain date
Environments
Issues for the Environments volume of the report, providing OS interfaces and similar
Foundations
Issues for the Foundations volume of the report, related to the core language semantics
Macrological Fascicle
Meta
Procedural and organisational issues
Multiple proposals exist
Multiple competing, concrete proposals to resolve this issue exist (whether they are SRFI or still only pre-SRFI)
Pie-in-the-sky ideas
Ideas currently lacking any form of worked-out proposal
Problems without solutions
Problems we *must* solve but haven’t worked out any solution for yet
Procedural Fascicle
Public Comment
Publications
Issues related to the practicalities of making the report available
Question
For information and clarification
R6RS Compatibility
Issue touches on questions of R6RS compatibility
R7RS-small
Issues with the Small language Report
Resolution in draft
A resolution (not necessarily final) is specified in the current draft of the relevant fascicle
Specification exists
Proposals for which a viable, but incomplete specification text exists
SRFI/RnRS spec exists
A SRFI for this proposal exists, or a solution from another RnRS
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
scheme/r7rs#376
Reference in a new issue
scheme/r7rs
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?