Artifacts Associated With Ticket 1480509fffffffff
Ticket change [a2bf60921e] (rid 109946) by afredd on 2006-05-02 16:13:46:
- assignee initialized to: "dkf"
- cmimetype initialized to: "text/plain"
- comment initialized to:
Currently srand() takes an integer (long) argument. It would be nice if it was extended to also handling wides that were too big for a long aswell. Rationale: expr {srand( [clock clicks] )} is probably not an uncomon idiom (well i use it :-) This is fine in 8.4 where [clock clicks] is a long, but under 8.5 gives the initially confusing error: can't use floating-point value as argument to srand Although rand()'s "randSeed" is a long, in the case where it is given a big wide, couldn't Tcl just, for example, truncate it down to a long? - foundin initialized to: "None"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "afredd"
- subsystem initialized to: ""
- title initialized to: "Allow srand() to handle big wides"
- type initialized to: "Bug"
Ticket change [5e8d438349] (rid 115656) by dkf on 2006-05-03 04:00:23:
- assignee changed to: "kennykb"
- icomment:
Logged In: YES user_id=79902 Actually, Tcl automatically seeds the PRNG with a value based on [clock clicks] anyway, even without being asked. The real use for srand() is for getting a *reproducable* sequence of pseudorandom numbers...
- login: "dkf"
- mimetype: "text/plain"
- priority changed to: "4"
- subsystem changed to: ""
- username: "dkf"
Ticket change [19f7108602] (rid 122895) by dgp on 2006-05-03 20:49:28:
- icomment:
Logged In: YES user_id=80530 Um, just a minor correction. Currently srand() takes an "int" argument, not a "long" argument. That is, only values that pass [string is integer -strict] are accepted.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [570b634e5a] (rid 94421) by afredd on 2006-05-03 21:44:08:
- icomment:
Logged In: YES user_id=1386588 I'm happy with Donal's answer - my call to srand() was unnecesary. I'm happy to close this report now. >Currently srand() takes an "int" >argument, not a "long" argument. >That is, only values that pass >[string is integer -strict] are >accepted. ...i was skeptical when i read this (!) but, you're right: % info pa 8.5a3 % string is integer -strict 4294967296 0 % string is integer -strict 4294967295 1 % expr srand(4294967295) 0.7574217011022483 % expr srand(4294967296) can't use floating-point value as argument to srand although, this isn't the behaviour of 8.4: % info pa 8.4.8 % string is integer -strict 4294967295 1 % string is integer -strict 4294967296 0 % expr srand(4294967295) 0.757421701102 % expr srand(4294967296) 0.242578298898
- login: "afredd"
- mimetype: "text/plain"
- username: "afredd"
- icomment:
Ticket change [69af35bdd4] (rid 103291) by dgp on 2006-05-03 21:46:17:
- icomment:
Logged In: YES user_id=80530 Um, sorry, I take that correction back. ExprSrandFunc does indeed pull a "long" from the argument, and then truncates to "int". And this means there's no simple way to test an argument for acceptability at the script level.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [909de6a2fc] (rid 120483) by dgp on 2006-05-03 21:51:59:
- icomment:
Logged In: YES user_id=80530 Note that on 32-bit platforms, "long" and "int" are identical, so the distinction I made doesn't show up there. I'm troubled that my 8.4 results are different from yours: % info patch 8.4.13 % expr srand(4294967295) 0.757421701102 % expr srand(4294967296) can't use floating-point value as argument to srand
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [f2f226b369] (rid 109646) by afredd on 2006-05-03 22:16:27:
- icomment:
Logged In: YES user_id=1386588 fyi - my previous 8.4 result was from an ActiveState installed tclsh... Just tried with a self built version: % info pa 8.4.11 % expr srand(4294967296) can't use floating-point value as argument to srand And with an older self built (debug): % info pa 8.4.6 % expr srand(4294967296) 0.242578298898
- login: "afredd"
- mimetype: "text/plain"
- username: "afredd"
- icomment:
Ticket change [cdb6ac1b34] (rid 95938) by dgp on 2006-05-03 22:29:30:
- icomment:
Logged In: YES user_id=80530 Mystery solved: 2005-04-05 Don Porter <[email protected]> * generic/tclExecute.c (ExprSrandFunc): Replaced incursions into the * generic/tclUtil.c (TclGetIntForIndex): intreps of numeric types with simpler calls of Tcl_GetIntFromObj and Tcl_GetLongFromObj, now that those routines are better behaved wrt shimmering. [Patch 1177219]
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [f714652969] (rid 130429) by dgp on 2006-05-03 22:31:17:
- icomment:
Logged In: YES user_id=80530 Mystery solved: 2005-04-05 Don Porter <[email protected]> * generic/tclExecute.c (ExprSrandFunc): Replaced incursions into the * generic/tclUtil.c (TclGetIntForIndex): intreps of numeric types with simpler calls of Tcl_GetIntFromObj and Tcl_GetLongFromObj, now that those routines are better behaved wrt shimmering. [Patch 1177219]
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [821b435395] (rid 117173) by dgp on 2006-05-03 22:42:25:
- assignee changed to: "dgp"
- icomment:
data_type - 110894 Logged In: YES user_id=80530 Looks like that change caused this bug.
- login: "dgp"
- mimetype: "text/plain"
- priority changed to: "7 High"
- subsystem changed to: "45. Parsing and Eval"
- username: "dgp"
Ticket change [019aae1b5c] (rid 119506) by dgp on 2006-05-03 22:44:34:
- foundin changed to: "obsolete: 8.4.10"
Ticket change [b47f41ae9c] (rid 125048) by dgp on 2006-05-04 19:32:21:
- icomment:
Logged In: YES user_id=80530 Here's a patch for 8.4.14
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Add attachment "1480509.patch" [bcacee49a5] (rid 101794) by dgp on 2006-05-04 19:32:24.
Ticket change [89d08d58ca] (rid 127288) by dgp on 2006-05-04 19:32:25:
- icomment:
File Added - 176828: 1480509.patch
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [4d0905428c] (rid 126996) by dgp on 2006-05-04 19:56:56:
- closedate changed to: "2006-05-04T12:56:56"
- closer changed to: "dgp"
- icomment:
Logged In: YES user_id=80530 and the patch for 8.5a4. Both patches committed.
- login: "dgp"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- username: "dgp"
Add attachment "1480509-85.patch" [18d79b88d7] (rid 122730) by dgp on 2006-05-04 19:56:57.
Ticket change [8d675cfad6] (rid 127923) by dgp on 2006-05-04 19:56:57:
- icomment:
File Added - 176830: 1480509-85.patch
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment: