This site is a static rendering of the Trac instance that was used by R7RS-WG1 for its work on R7RS-small (PDF), which was ratified in 2013. For more information, see Home.

Ticket 364: truncate, floor, ceiling round should return a non-finite argument

2012-10-05 12:48:34
WG1 - Core
cowan
major
cowan
fixed
source
closed
2012-03-26 01:28:49
defect

Currently R7RS is silent on what truncate, floor, ceiling, and round do when the argument is +inf.0, -inf.0, or +nan.0. R6RS has them return the argument, which seems reasonable.

I tested (round (* 1.0e200 1.0e200)) on my usual suite of Schemes. Racket, Gauche, Chicken (with and without the numbers egg), Bigloo, Guile, Kawa, Chibi, Chez, SCM, Ikarus/Vicare, Larceny, Ypsilon, Mosh, IronScheme, NexJ, STklos, KSi, Shoe, BDC, Rep, Schemik, Elk, Spark all return the argument.

MIT, Gambit, Scheme48/scsh, SISC, Scheme 9, Scheme 7, signal errors.

SigScheme, TinyScheme, Dream, UMB don't work for one or another reason.

Oaklisp and Owl Lisp don't do flonums.

XLisp only has fixnums and flonums, and returns the largest or smallest fixnum as the case may be.

RScheme returns a variety of slightly strange values: (round +inf.0), for example, is 0, but (round -inf.0) is -inf.0.

descriptionCurrently R7RS is silent on what `truncate`, `floor`, `ceiling`, and `round` do when the argument is `+inf.0`, `-inf.0`, or `+nan.0`. R6RS has them return the argument, which seems reasonable. I tested `(round (* 1.0e200 1.0e200))` on my usual suite of Schemes. Racket, Gauche, Chicken (with and without the numbers egg), Bigloo, Guile, Kawa, Chibi, Chez, SCM, Ikarus/Vicare, Larceny, Ypsilon, Mosh, !IronScheme, !NexJ, STklos, KSi, Shoe, BDC, Rep, Schemik, Elk, Spark all return the argument. MIT, Gambit, Scheme48/scsh, SISC, Scheme 9, Scheme 7, !SigScheme, !TinyScheme, Dream, UMB don't work for one or another reason. Oaklisp and Owl Lisp don't do flonums. XLisp only has fixnums and flonums, and returns the largest or smallest fixnum as the case may be. RScheme returns a variety of slightly strange values: `(round +inf.0)`, for example, is `0`, but `(round -inf.0)` is `-inf.0`.Currently R7RS is silent on what `truncate`, `floor`, `ceiling`, and `round` do when the argument is `+inf.0`, `-inf.0`, or `+nan.0`. R6RS has them return the argument, which seems reasonable. I tested `(round (* 1.0e200 1.0e200))` on my usual suite of Schemes. Racket, Gauche, Chicken (with and without the numbers egg), Bigloo, Guile, Kawa, Chibi, Chez, SCM, Ikarus/Vicare, Larceny, Ypsilon, Mosh, !IronScheme, !NexJ, STklos, KSi, Shoe, BDC, Rep, Schemik, Elk, Spark all return the argument. MIT, Gambit, Scheme48/scsh, SISC, Scheme 9, Scheme 7, signal errors. !SigScheme, !TinyScheme, Dream, UMB don't work for one or another reason. Oaklisp and Owl Lisp don't do flonums. XLisp only has fixnums and flonums, and returns the largest or smallest fixnum as the case may be. RScheme returns a variety of slightly strange values: `(round +inf.0)`, for example, is `0`, but `(round -inf.0)` is `-inf.0`.
statusnewdecided

WG1 decided that these functions return these arguments unchanged.

owneralexshinncowan
statusdecidedwriting
resolutionfixed
statuswritingclosed