diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2011-12-11 19:56:03 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2011-12-11 19:56:03 -0800 |
commit | 68fbc5322e282f41e2ee8c84cc16f6b6a4d39670 (patch) | |
tree | 8a8f3a52a29e05d9267d45b7774288450aaffee4 /lib.c | |
parent | af4986ea5e82d32f9699d41781f60d9b77ba9748 (diff) | |
download | txr-68fbc5322e282f41e2ee8c84cc16f6b6a4d39670.tar.gz txr-68fbc5322e282f41e2ee8c84cc16f6b6a4d39670.tar.bz2 txr-68fbc5322e282f41e2ee8c84cc16f6b6a4d39670.zip |
Bignum division implemented. More portability bugs found in MPI:
code like 1 << n, where n exceeds the width of the type int.
* arith.c (trunc): New function, reimplementation of removed
trunc from lib.c.
* lib.c (trunc): Removed.
* mpi-patches/fix-bad-shifts: New file.
Diffstat (limited to 'lib.c')
-rw-r--r-- | lib.c | 14 |
1 files changed, 0 insertions, 14 deletions
@@ -857,20 +857,6 @@ val mulv(val nlist) return reduce_left(func_n2(mul), cdr(nlist), car(nlist), nil); } -val trunc(val anum, val bnum) -{ - cnum a = c_num(anum); - cnum b = c_num(bnum); - - numeric_assert (b != 0); - - { - cnum result = a / b; - numeric_assert (result <= NUM_MAX); - return num(result); - } -} - val mod(val anum, val bnum) { cnum a = c_num(anum); |