Implement 'div', 'mod', and 'div-and-mod' in Scheme

Issue #61 resolved
Katie Burke created an issue

If x1 and x2 are exact, x2 must not be zero. These procedures implement number-theoretic integer division, with the div operation being related to quotient and the mod operation being related to remainder or modulo, but in both cases extended to handle real numbers.
( http://www.scheme.com/tspl4/objects.html#./objects:s99 )

(div 17 3)

Traceback (most recent call last):
File "stdin", line 1, col 2
RunTimeError: unbound variable 'div'

(mod 17 3)

Traceback (most recent call last):
File "stdin", line 1, col 2
RunTimeError: unbound variable 'mod'

(div-and-mod 17.5 3)

Traceback (most recent call last):
File "stdin", line 1, col 2
RunTimeError: unbound variable 'div-and-mod'

Comments (2)

  1. Log in to comment