Implement truncate, floor and ceiling in scheme

Issue #80 new
Katie Burke created an issue

Using each in the format (truncate real ), (floor real), (ceiling real)...
truncate should return the integer closest to real toward zero.
floor should return the integer closest to real toward negative infinity.
ceiling should return the integer closest to real toward infinity. ( http://www.scheme.com/tspl4/objects.html#./objects:s101 )

This should return 17.0.

(truncate 17.3)

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

This should return 17.0

(floor 17.3)

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

This should return 18.0

(ceiling 17.3)

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

Comments (2)

  1. Log in to comment