diff --git a/LOG b/LOG index 1c9560bf04..cf7b4dc347 100644 --- a/LOG +++ b/LOG @@ -1313,3 +1313,5 @@ externs.h, system.h, expeditor.c, configure, Mf-*, Makefile.*nt, workarea, mat.ss, io.ms, io.stex, objects.stex, release_notes.stex, root-experr*, patch* +- fix multiply of most negative fixnum to itself on 64-bit platforms + number.c, 5_3.ms diff --git a/c/number.c b/c/number.c index a7930eefff..1fd2f4b308 100644 --- a/c/number.c +++ b/c/number.c @@ -637,7 +637,7 @@ static ptr big_mul(tc, x, y, xl, yl, sign) ptr tc, x, y; iptr xl, yl; IBOOL sign return copy_normalize(&BIGIT(W(tc),0),xl+yl,sign); } -#define SHORTMIN (most_negative_fixnum / (1 << (fixnum_bits / 2))) +#define SHORTMIN ((most_negative_fixnum / (1 << (fixnum_bits / 2))) + 1) #define SHORTMAX (most_positive_fixnum / (1 << (fixnum_bits / 2))) #define SHORTRANGE(x) ((x) >= SHORTMIN && (x) <= SHORTMAX) diff --git a/mats/5_3.ms b/mats/5_3.ms index fc84f82118..5d3bc41214 100644 --- a/mats/5_3.ms +++ b/mats/5_3.ms @@ -1628,6 +1628,14 @@ (error? (* 'a 3 4)) (error? (* 3 5 'a 4)) (eqv? (* 1 2) 2) + (let loop ([n 0]) + (or (= n 100) + (and + (eqv? (* (expt 2 n) (expt 2 n)) (expt 2 (* 2 n))) + (eqv? (* (- (expt 2 n)) (- (expt 2 n))) (expt 2 (* 2 n))) + (eqv? (* (- (expt 2 n)) (expt 2 n)) (- (expt 2 (* 2 n)))) + (eqv? (* (expt 2 n) (- (expt 2 n))) (- (expt 2 (* 2 n)))) + (loop (add1 n))))) (fl~= (* 1.0 2) 2.0) (fl~= (* 1 2.0) 2.0) (eqv? (* 3/5 2/5) 6/25)