summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--doc/mathfunc.n7
-rw-r--r--generic/tclBasic.c19
3 files changed, 23 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 52cb9e7..19f6f20 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-05-04 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tclBasic.c (ExprSrandFunc): Restore acceptance of wide/big
+ * doc/mathfunc.n: integer values by srand() [Bug 1480509].
+
2006-04-26 Don Porter <dgp@users.sourceforge.net>
*** 8.5a4 TAGGED FOR RELEASE ***
diff --git a/doc/mathfunc.n b/doc/mathfunc.n
index 21d0371..c3133b2 100644
--- a/doc/mathfunc.n
+++ b/doc/mathfunc.n
@@ -6,7 +6,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: mathfunc.n,v 1.9 2006/04/26 04:41:10 dgp Exp $
+'\" RCS: @(#) $Id: mathfunc.n,v 1.10 2006/05/04 12:55:49 dgp Exp $
'\"
.so man.macros
.TH mathfunc n 8.5 Tcl "Tcl Mathematical Functions"
@@ -232,9 +232,8 @@ argument is a numeric value that exceeds the square of the maximum value of
the floating-point range.
.TP
\fBsrand(\fIarg\fB)\fR
-The \fIarg\fR, which must be an integer value acceptable to
-\fBstring is integer\fR (that is, a 32-bit integer), is used to reset the
-seed for the random number generator of \fBrand\fR. Returns the first random
+The \fIarg\fR, which must be an integer, is used to reset the seed for
+the random number generator of \fBrand\fR. Returns the first random
number (see \fBrand()\fR) from that seed. Each interpreter has its own seed.
.TP
\fBtan(\fIarg\fB)\fR
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index 511258f..caffa5f 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclBasic.c,v 1.193 2006/03/06 21:56:34 dgp Exp $
+ * RCS: @(#) $Id: tclBasic.c,v 1.194 2006/05/04 12:55:49 dgp Exp $
*/
#include "tclInt.h"
@@ -5677,9 +5677,20 @@ ExprSrandFunc(
return TCL_ERROR;
}
- if (Tcl_GetLongFromObj(interp, objv[1], &i) != TCL_OK) {
- /* TODO: more ::errorInfo here? or in caller? */
- return TCL_ERROR;
+ if (Tcl_GetLongFromObj(NULL, objv[1], &i) != TCL_OK) {
+ Tcl_Obj *objPtr;
+ mp_int big;
+
+ if (Tcl_GetBignumFromObj(interp, objv[1], &big) != TCL_OK) {
+ /* TODO: more ::errorInfo here? or in caller? */
+ return TCL_ERROR;
+ }
+
+ mp_mod_2d(&big, (int) CHAR_BIT * sizeof(long), &big);
+ objPtr = Tcl_NewBignumObj(&big);
+ Tcl_IncrRefCount(objPtr);
+ Tcl_GetLongFromObj(NULL, objPtr, &i);
+ Tcl_DecrRefCount(objPtr);
}
/*