bogus bignum exponent calculations
Closed / Fixed2798543fffffffffffffffffffffffffffffffffCreated 18 years agoUpdated 18 years ago
Descriptionplain2009-05-29 18:53:19
% string length [expr {10**2**15}]
32769
% string length [expr {10**2**16}]
17
% expr {10**2**16}
21936950640377856
dgpplain2009-05-30 02:25:15
Simpler demo:
% expr {10**65536}
21936950640377856
Something in the logic that chooses
among the many (!!) implementations of
exponent computation is borked.
dgpplain2009-05-30 02:35:02
Something wrong computing the value of "base" at line 5963? Computation is done in a short int, but what happens when l2 is so big that we're overflowing that?
dgpplain2009-05-30 04:36:32
More ugliness:
% expr {10**65553 == 10**17}
1
andreas_kupriesplain2009-05-30 04:54:11
Curiosity: Is that ugliness all in Tcl's use of libtommath, or in libtommath itself ?
dgpplain2009-05-30 22:01:16
Neither. All appearances say it's in TEBC's own "optimized table lookup" implementation.
andreas_kupriesplain2009-06-01 22:39:01
Ok. The optimized table lookup is Kevin's work, IIRC.
dgpplain2009-06-01 23:55:03
Similar trouble in the 32 bit
table lookup:
% expr {7**9 == 7**65545}
1
dgpplain2009-06-02 04:35:54
tests committed demonstrating broken cases
dgpplain2009-06-03 00:58:29
allow_comments - 1 Fixes committed.
Log in (anonymous is fine) to add a comment.