ruricolist / serapeum

Utilities beyond Alexandria
MIT License
425 stars 42 forks source link

Off-by-one in DEFINE-REAL-RANGE #57

Closed ramenbytes closed 4 years ago

ramenbytes commented 4 years ago

Expected:

(range -1/4 2/4 2/4) => #(-1/4 1/4)

Actual:

(range -1/4 2/4 2/4) => #(-1/4)

Relevant expression is on line 189 of range.lisp:

(floor (abs (/ (- stop start) step)))

Changing it to (ceiling (abs (/ (- stop start) step))) yields the expected value, though I haven't exhaustively tested it beyond some poking in the repl.