Skip to content
Tcl Source Code History Of Ticket 1480509
Login

History Of Ticket 1480509

Artifacts Associated With Ticket 1480509

  1. Ticket change [a2bf60921e] (rid 109946) by afredd on 2006-05-02 16:13:46:

    1. assignee initialized to: "dkf"
    2. cmimetype initialized to: "text/plain"
    3. 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?
      
    4. foundin initialized to: "None"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "afredd"
    9. subsystem initialized to: ""
    10. title initialized to: "Allow srand() to handle big wides"
    11. type initialized to: "Bug"
  2. Ticket change [5e8d438349] (rid 115656) by dkf on 2006-05-03 04:00:23:

    1. assignee changed to: "kennykb"
    2. 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...
      
      
    3. login: "dkf"
    4. mimetype: "text/plain"
    5. priority changed to: "4"
    6. subsystem changed to: ""
    7. username: "dkf"
  3. Ticket change [19f7108602] (rid 122895) by dgp on 2006-05-03 20:49:28:

    1. 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.
      
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  4. Ticket change [570b634e5a] (rid 94421) by afredd on 2006-05-03 21:44:08:

    1. 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
      
      
      
      
      
      
    2. login: "afredd"
    3. mimetype: "text/plain"
    4. username: "afredd"
  5. Ticket change [69af35bdd4] (rid 103291) by dgp on 2006-05-03 21:46:17:

    1. 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.
      
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  6. Ticket change [909de6a2fc] (rid 120483) by dgp on 2006-05-03 21:51:59:

    1. 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
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  7. Ticket change [f2f226b369] (rid 109646) by afredd on 2006-05-03 22:16:27:

    1. 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
      
      
      
    2. login: "afredd"
    3. mimetype: "text/plain"
    4. username: "afredd"
  8. Ticket change [cdb6ac1b34] (rid 95938) by dgp on 2006-05-03 22:29:30:

    1. 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]
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  9. Ticket change [f714652969] (rid 130429) by dgp on 2006-05-03 22:31:17:

    1. 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]
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  10. Ticket change [821b435395] (rid 117173) by dgp on 2006-05-03 22:42:25:

    1. assignee changed to: "dgp"
    2. icomment:
      
      
      data_type - 110894
      
      Logged In: YES 
      user_id=80530
      
      
      Looks like that change caused this
      bug.
      
      
    3. login: "dgp"
    4. mimetype: "text/plain"
    5. priority changed to: "7 High"
    6. subsystem changed to: "45. Parsing and Eval"
    7. username: "dgp"
  11. Ticket change [019aae1b5c] (rid 119506) by dgp on 2006-05-03 22:44:34:

    1. foundin changed to: "obsolete: 8.4.10"
  12. Ticket change [b47f41ae9c] (rid 125048) by dgp on 2006-05-04 19:32:21:

    1. icomment:
      Logged In: YES 
      user_id=80530
      
      
      Here's a patch for 8.4.14
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  13. Add attachment "1480509.patch" [bcacee49a5] (rid 101794) by dgp on 2006-05-04 19:32:24.

  14. Ticket change [89d08d58ca] (rid 127288) by dgp on 2006-05-04 19:32:25:

    1. icomment:
      
      
      File Added - 176828: 1480509.patch
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  15. Ticket change [4d0905428c] (rid 126996) by dgp on 2006-05-04 19:56:56:

    1. closedate changed to: "2006-05-04T12:56:56"
    2. closer changed to: "dgp"
    3. icomment:
      Logged In: YES 
      user_id=80530
      
      
      and the patch for 8.5a4.
      
      Both patches committed.
      
      
    4. login: "dgp"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"
    8. username: "dgp"
  16. Add attachment "1480509-85.patch" [18d79b88d7] (rid 122730) by dgp on 2006-05-04 19:56:57.

  17. Ticket change [8d675cfad6] (rid 127923) by dgp on 2006-05-04 19:56:57:

    1. icomment:
      
      
      File Added - 176830: 1480509-85.patch
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"