Groups
Groups
Sign in
Groups
Groups
chez-scheme
Conversations
About
Send feedback
Help
Modulo Does Not Match Quotient
14 views
Skip to first unread message
Eleanor Bartle
unread,
Jul 1, 2026, 11:17:22 PM
Jul 1
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to chez-scheme
On my local installation (10.4.1 on macOS arm64), the following expressions evaluate thusly:
> (quotient -1 2)
0
> (modulo -1 2)
1
> (+ (* (quotient -1 2) 2) (modulo -1 2))
1
That is, quotient truncates, but modulo assumes flooring quotient. Thus, the defining equation of quotient and modulo does not hold.
Is this a mistake? A glitch? An implementation oversight? A highly unfortunate detail of R6RS?
Pierpaolo BERNARDI
unread,
Jul 2, 2026, 8:57:05 AM
Jul 2
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Eleanor Bartle, chez-scheme
The "matching" pairs are quotient / remainder, div / mod, div0 / mod0.
The procedures, quotient, remainder, and modulo are there for
compatibility with previous standards.
No mistakes, no oversights :)
https://www.scheme.com/tspl4/objects.html#./objects:s98
====
> --
> You received this message because you are subscribed to the Google Groups "chez-scheme" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
chez-scheme...@googlegroups.com
.
> To view this discussion visit
https://groups.google.com/d/msgid/chez-scheme/3f0ccc25-c5b3-434d-9403-0b4e3c41ebf0n%40googlegroups.com
.
Reply all
Reply to author
Forward
0 new messages