Skip to content

Commit

Permalink
Fix rounding bug
Browse files Browse the repository at this point in the history
  • Loading branch information
yitzchak committed Jul 28, 2024
1 parent ec0d67d commit b578236
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion code/floating-point-printers.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
(when (and (< (+ decimal-position count) (length decimal-digits))
(< -1 (+ decimal-position count) (length decimal-digits))
(> (aref decimal-digits (+ decimal-position count)) 4))
(loop for pos = (+ decimal-position count -1)
(loop for pos = (+ decimal-position count -1) then (1- pos)
for (carry new-digit) = (multiple-value-list (floor (1+ (aref decimal-digits pos)) 10))
do (setf (aref decimal-digits pos) new-digit)
when (zerop carry)
Expand Down

0 comments on commit b578236

Please sign in to comment.