[gambit-list] Patch to speed bignum division in common case

Marc Feeley feeley at iro.umontreal.ca
Wed Sep 25 11:41:15 EDT 2013


On 2013-09-25, at 11:13 AM, Bradley Lucier <lucier at math.purdue.edu> wrote:

> On 09/24/2013 05:00 PM, Marc Feeley wrote:
>> 
>> On 2013-09-20, at 7:25 PM, Bradley Lucier <lucier at math.purdue.edu> wrote:
>> 
>>> Marc:
>>> 
>>> Please find enclosed a patch that speeds bignum division in the
>>> common case where (quotient a b) is a relatively small integer.
>>> gits2-gambit.scm><_num-scm.patch>
>> Unfortunately there's something wrong with your patch.  Here's the
>> output of "make check" on my Mac.
> 
> Hmmm.  I don't see any problems when I run make check. I just
> regenerated the patch, but the file is the same.
> 
> I generated my patch on Ubuntu Linux; could this be a line ending
> mismatch problem?
> 
> I'm resending the patch in case it got corrupted the first time.
> 
> Brad
> 
> <_num-scm.patch>

There's still a problem:

% uname -a
Darwin neo.local 12.4.0 Darwin Kernel Version 12.4.0: Wed May  1 17:57:12 PDT 2013; root:xnu-2050.24.15~1/RELEASE_X86_64 x86_64
% patch -p1 < _num-scm.patch
patching file lib/_num.scm
Hunk #1 succeeded at 9043 (offset -2 lines).
Hunk #2 succeeded at 9269 (offset -2 lines).
% make check
making all in include
...
------------ TEST 1 (debugging support)
../gsi/gsi -:~~bin=../bin,~~lib=../lib,~~include=../include -f debug.scm > test1.out
diff test1.ok test1.out && rm -f test1.out
------------ TEST 2 (error handling)
../gsi/gsi -:m1,h4000,~~bin=../bin,~~lib=../lib,~~include=../include -f error.scm < error.scm > test2.out
diff test2.ok test2.out && rm -f test2.out
------------ TEST 3 (interpreter and library functions)
../gsi/gsi -:s,~~bin=../bin,~~lib=../lib,~~include=../include -f -e '(begin (load "r4rstest.scm") (test-cont) (test-sc4) (test-delay) (exit))' > test3.out
diff test3.ok test3.out && rm -f test3.out tmp*
582,584c582,601
<   ==> #t
<   ==> #t
<   ==> #t
---
> Number readback failure for (+ 1. (* -97 2.220446049250313e-16))
> .9999999999999785
> Number readback failure for (+ 10. (* -94 1.7763568394002505e-15))
> 9.999999999999833
> Number readback failure for (+ 100. (* -98 1.4210854715202004e-14))
> 99.99999999999861
>   ==> #f
>  BUT EXPECTED #t
> Number readback failure for (+ 3. (* -85 4.440892098500626e-16))
> 2.9999999999999623
> Number readback failure for (+ 30. (* -83 3.552713678800501e-15))
> 29.999999999999705
> Number readback failure for (+ 300. (* -80 5.684341886080802e-14))
> 299.99999999999545
>   ==> #f
>  BUT EXPECTED #t
> Number readback failure for (+ 7. (* -94 8.881784197001252e-16))
> 6.9999999999999165
>   ==> #f
>  BUT EXPECTED #t
621c638,643
< Passed all tests
---
> errors were:
> (SECTION (got expected (call)))
> ((6 5 6) (#f #t (mult-float-print-test #f)))
> ((6 5 6) (#f #t (mult-float-print-test #f)))
> ((6 5 6) (#f #t (mult-float-print-test #f)))
> 
631c653,658
< Passed all tests
---
> errors were:
> (SECTION (got expected (call)))
> ((6 5 6) (#f #t (mult-float-print-test #f)))
> ((6 5 6) (#f #t (mult-float-print-test #f)))
> ((6 5 6) (#f #t (mult-float-print-test #f)))
> 
647c674,679
< Passed all tests
---
> errors were:
> (SECTION (got expected (call)))
> ((6 5 6) (#f #t (mult-float-print-test #f)))
> ((6 5 6) (#f #t (mult-float-print-test #f)))
> ((6 5 6) (#f #t (mult-float-print-test #f)))
> 
658c690,695
< Passed all tests
---
> errors were:
> (SECTION (got expected (call)))
> ((6 5 6) (#f #t (mult-float-print-test #f)))
> ((6 5 6) (#f #t (mult-float-print-test #f)))
> ((6 5 6) (#f #t (mult-float-print-test #f)))
> 
make[1]: *** [test3] Error 1
make: *** [check] Error 2




More information about the Gambit-list mailing list