Overview
| Artifact ID: | ac7b5564544794cc40ecc7c513cf900f21c68ebc |
|---|---|
| Ticket: | 1228275fffffffffffffffffffffffffffffffff
[expr] cannot cope with wideInt results on 32bit UNIX |
| User & Date: | matzek on 2005-06-27 13:55:26 |
Changes
- assignee changed to: "dkf"
- cmimetype changed to: "text/plain"
- comment changed to:
Hi *, although I haven't found much documentation about this [expr] behavior, Welch et al. are writing: "The result of an arithmetic operation is [...] a wide integer if at least one of the operands is a wide integer, and a normal integer otherwise." And the manual of [expr] says: "wide(arg): Converts arg to an integer value at least 64-bits wide (by sign-extension if arg is a 32-bit number) if it is not one already." I now have two values, both fitting into a signed integer, which would need a wide integer when summed up. But I am somehow unable to get the right result: $ tcl-8.4.9/bin/tclsh8.4 % expr {(1<<31)+1} -2147483647 % expr {(1<<31)+wide(1)} -2147483647 % expr {wide(1<<31)+1} -2147483647 % expr {wide((1<<31))+1} -2147483647 % expr {wide((1<<31)+1)} -2147483647 On a 64bit system and compiled with --enable-64bit, I get the right result, right from the start: $ tcl-8.4.9/bin/tclsh8.4 % expr {(1<<31)+1} 2147483649 -- Matthias Kraft - foundin changed to: "obsolete: 8.4.9"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "matzek"
- subsystem changed to: "16. Commands A-H"
- title changed to:
[expr] cannot cope with wideInt results on 32bit UNIX
- type changed to: "Bug"