Artifacts Associated With Ticket 758488ffffffffff
Ticket change [7fc6308e01] (rid 97616) by hgschulz on 2003-06-21 18:09:02:
- assignee initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
Given the support for 64-bit numbers, there's no reason that pow(2,63) shouldn't do the right thing. Currently, it does expr wide(pow(2,63)) 9223372036854775807 which is off by one. Other 64-bit computations are also odd: expr wide(1 << 62) 1073741824 expr 1 << 62 1073741824
- foundin initialized to: "obsolete: 8.4.3"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "hgschulz"
- subsystem initialized to: "None"
- title initialized to: "pow(2,63) returns wrong result"
- type initialized to: "Bug"
Ticket change [d9a082453b] (rid 107642) by dgp on 2003-06-23 01:32:01:
- assignee changed to: "dgp"
- closedate changed to: "2003-06-22T18:32:01"
- closer changed to: "dgp"
- icomment:
Logged In: YES user_id=80530 Your demo script does not show anything wrong with the pow() function. pow(2,63) should return a double representation of the value 2^63 = 9223372036854775808. It does: % format %.19g [expr {pow(2,63)}] 9223372036854775808 When you pass that value to wide(), though, you ask for the wide integer value of 2^63, which can't be done because valid wide integers are those in the range -2^63 to (2^63) - 1. Use of 64-bit ints does not make overflow issues go away, it just changes where they happen. On the other matter, try this: % expr {wide(1) << 62} 4611686018427387904 - login: "dgp"
- mimetype: "text/plain"
- resolution changed to: "Invalid"
- status changed to: "Closed"
- subsystem changed to: "47. Bytecode Compiler"
- username: "dgp"
Ticket change [e941ed7ee7] (rid 104790) by hgschulz on 2003-06-23 01:43:20:
- icomment:
Logged In: YES user_id=115926 The documentation at http://www.tcl.tk/man/tcl8.4/TclCmd/expr.htm does not indicate that pow() converts the arguments to double or that it returns a double. In addition, << and >> only mention that they work with 'integers'. The documentation also says: "On 32-bit systems, integer values MAX_INT (0x7FFFFFFF) and MIN_INT (-0x80000000) will be represented as 32-bit values, and integer values outside that range will be represented as 64-bit values (if that is possible at all.)" Thus, from the description, one can reasonably assume that 1 << 48, say, will produce a valid 64-bit number, not some 32-bit result.
- login: "hgschulz"
- mimetype: "text/plain"
- username: "hgschulz"
- icomment:
Ticket change [8b75a9cdae] (rid 127572) by dgp on 2003-06-23 06:45:04:
- assignee changed to: "dkf"
- icomment:
Logged In: YES user_id=80530 fair enough. Assigning to the contributor of the latest 64-bit improvements for his opinion on what documentation improvements might be a good idea. If you can help with contributed improvements, or by asking questions about what the current docs do not make clear, please do so. Meanwhile, TIP 72 might provide additional information about Tcl's new 64-bit capabilities that you find useful http://purl.org/tcl/tip/72.html
- login: "dgp"
- mimetype: "text/plain"
- priority changed to: "3 Low"
- resolution changed to: "Remind"
- status changed to: "Open"
- title changed to: "improved docs for 64-bit computations"
- username: "dgp"
Ticket change [7cb15333e9] (rid 97123) by dkf on 2003-06-25 03:25:20:
- icomment:
Logged In: YES user_id=79902 pow() is basically an embedding of pow() from the C math library. That in turn is not an integer-returning function. Hence neither is the Tcl version, and wrapping wide() around it doesn't change anything; it just bandages on a type-conversion afterwards.
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [5691781bd3] (rid 94346) by dkf on 2003-07-05 05:29:38:
- closedate changed to: "2003-07-04T22:29:38"
- closer changed to: "dkf"
- icomment:
File Added - 54981: exprdoc.patch Logged In: YES user_id=79902 Tightened up the wording in expr.n as it was slightly loose from the PoV of people coming from other than a C/C++ background. I attach the patch I've applied (to both the HEAD and 8.4) here. Henning, if you feel that the alterations it makes are insufficient, could you please supply more detail about how you feel things should be fixed? Thanks!
- login: "dkf"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- username: "dkf"
Add attachment "exprdoc.patch" [a909c4e4f6] (rid 99087) by dkf on 2003-07-05 05:29:38.