klisp

an open source interpreter for the Kernel Programming Language.
git clone http://git.hanabi.in/repos/klisp.git
Log | Files | Refs | README

commit 496c266b397d98aaf73d6d8b52b9ccd4f958b836
parent caf70fec181120b02c0107a94f55f9d09789afe1
Author: Andres Navarro <canavarro82@gmail.com>
Date:   Fri, 21 Oct 2011 01:06:21 -0300

Fixed a bug (I think!, still waiting for confirmation from Fromberger) in the division routine of imath that caused problems in dtoa (for example with printing 1.1) and of course in div-and-mod and div0-and-mod0.

Diffstat:
Msrc/imath.c | 3++-
Msrc/tests/numbers.k | 12++++--------
2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/src/imath.c b/src/imath.c @@ -3228,7 +3228,8 @@ STATIC mp_result s_udiv(klisp_State *K, mp_int a, mp_int b) mp_word pfx = r.digits[r.used - 1]; mp_word qdigit; - if(r.used > 1 && pfx <= btop) { + // Bugfix (was pfx <= btop in imath <= 1.17) Andres Navarro + if(r.used > 1 && pfx < btop) { pfx <<= MP_DIGIT_BIT / 2; pfx <<= MP_DIGIT_BIT / 2; pfx |= r.digits[r.used - 2]; diff --git a/src/tests/numbers.k b/src/tests/numbers.k @@ -1,6 +1,6 @@ ;; check.k & test-helpers.k should be loaded ;; -;; I fixed a number of bugs and added some rationale to some of the tests +;; I fixed all of the bugs and added some rationale to some of the tests ;; marked as FAIL. In some cases, as you say, the specification is unclear. ;; In these cases I tried to include my interpretation (which could be wrong), ;; and changed the test to reflect this. @@ -10,13 +10,9 @@ ;; Shutt for clarification (but I warn you that while he is very cooperative ;; with this kind of things he sometimes takes a while to answer). ;; -;; The round thing is actually a bug in dtoa (kreal.c) the function that -;; converts doubles to strings and has nothing to do with rounding. -;; When the error msg was being generated the interpreter entered an infinite -;; loop in dtoa. -;; You can test this easily just entering 1.1 in the interpreter. -;; I'll have to work on this one. I'll have to reread the paper and work on it -;; with gdb. +;; The round thing was actually a bug in the IMath division routine +;; I fixed it (I think!) and have sent an email to the maintainer to +;; report the bug and hopefully confirm the correctness of the fix ;; ;; Andres Navarro ;;