diff options
author | dgp <dgp@users.sourceforge.net> | 2006-10-30 16:30:34 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2006-10-30 16:30:34 (GMT) |
commit | 1f4e15f7d1e456995a619f7540eca11f31d5f6ed (patch) | |
tree | 480083628a026836117223a7fee5b8c5671db116 | |
parent | 6cedc6f77615111061dbfa644e31fa5caae30ca4 (diff) | |
download | tcl-1f4e15f7d1e456995a619f7540eca11f31d5f6ed.zip tcl-1f4e15f7d1e456995a619f7540eca11f31d5f6ed.tar.gz tcl-1f4e15f7d1e456995a619f7540eca11f31d5f6ed.tar.bz2 |
* generic/tclExecute.c (INST_MOD): Corrected improper testing of
* tests/expr.test: the sign of bignums when applying Tcl's
division rules. Thanks to Peter Spjuth. [Bug 1585704]
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | generic/tclExecute.c | 6 | ||||
-rw-r--r-- | tests/expr.test | 15 |
3 files changed, 23 insertions, 4 deletions
@@ -1,3 +1,9 @@ +2006-10-30 Don Porter <dgp@users.sourceforge.net> + + * generic/tclExecute.c (INST_MOD): Corrected improper testing of + * tests/expr.test: the sign of bignums when applying Tcl's + division rules. Thanks to Peter Spjuth. [Bug 1585704] + 2006-10-26 Miguel Sofer <msofer@users.sf.net> * generic/tclNamesp.c (EnsembleImplementationCmd): diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 660be98..b33e6b2b 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclExecute.c,v 1.246 2006/09/28 20:06:42 dgp Exp $ + * RCS: @(#) $Id: tclExecute.c,v 1.247 2006/10/30 16:30:35 dgp Exp $ */ #include "tclInt.h" @@ -3796,7 +3796,7 @@ TclExecuteByteCode( } /* TODO: internals intrusion */ - if ((l1 > 0) ^ big2.sign) { + if ((l1 > 0) ^ (big2.sign == MP_ZPOS)) { /* Arguments are opposite sign; remainder is sum */ mp_int big1; TclBNInitBignumFromLong(&big1, l1); @@ -3844,7 +3844,7 @@ TclExecuteByteCode( } /* TODO: internals intrusion */ - if ((w1 > ((Tcl_WideInt) 0)) ^ big2.sign) { + if ((w1 > ((Tcl_WideInt) 0)) ^ (big2.sign == MP_ZPOS)) { /* Arguments are opposite sign; remainder is sum */ mp_int big1; TclBNInitBignumFromWideInt(&big1, w1); diff --git a/tests/expr.test b/tests/expr.test index dafdc8e..9fc56e5 100644 --- a/tests/expr.test +++ b/tests/expr.test @@ -10,7 +10,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: expr.test,v 1.63 2006/10/09 19:15:44 msofer Exp $ +# RCS: @(#) $Id: expr.test,v 1.64 2006/10/30 16:30:36 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2.1 @@ -5368,6 +5368,19 @@ test expr-32.2 {expr div basics} { -3 -2 -1 -1 -1 \ ] +test expr-32.3 {Bug 1585704} { + expr 1%(1<<63) +} 1 +test expr-32.4 {Bug 1585704} { + expr -1%(1<<63) +} [expr (1<<63)-1] +test expr-32.5 {Bug 1585704} { + expr (1<<32)%(1<<63) +} [expr 1<<32] +test expr-32.6 {Bug 1585704} { + expr -(1<<32)%(1<<63) +} [expr (1<<63)-(1<<32)] + test expr-33.1 {parse largest long value} longIs32bit { set max_long_str 2147483647 set max_long_hex "0x7FFFFFFF " |