expr {7244019458077122840 << 1}
Closed / Fixed920e39363459606aa1a1776fcde35e968f497ab5Created 3 years agoUpdated 3 years ago
Descriptionplain2023-08-25 13:57:59
With [73da5acb07c] on 64-bit linux expr {7244019458077122840 << 1} returns 14488038916154245680 to me. With same version on 64-bit Windows (mingw-build) it retuns -3958705157555305936 to me. On the same windows 10 box, build with the sam tool chain 8.6.13 agrees with the result on linux.
Referenced by2
a5f08edc65Merge [bfae0eecac615b8e], "Fix [920e393634]: expr {7244019458077122840 << 1}. Some more long -> Tcl_WideInt fixes in comments". check-in2024-08-20 15:42:212ed2ec021bFix [920e393634]: expr {7244019458077122840 << 1}. Some more long -> Tcl_WideInt fixes in comments check-in2023-08-25 20:34:32
apnadkarnimarkdown2023-08-25 16:41:02
Just to add a bit more information, the breakage is when the result exceeds TCL_WIDE_MAX.
% expr {0x3fffffffffffffff << 1}
9223372036854775806
% expr {0x4000000000000000 << 1}
-9223372036854775808
jan.nijtmanswiki2023-08-25 21:06:49
Didn't try it on 32-bit hardware yet, but I'm quite sure that the "1UL" here was the real problem.
Commit: [2ed2ec021b6959ee]
Thanks!
jan.nijtmans Pending ticket [920e393634].
[History diff]2023-08-25 21:07:48
jan.nijtmans Closed ticket [920e393634].
[History diff]2023-09-12 12:28:23
Log in (anonymous is fine) to add a comment.