summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2006-05-04 12:55:49 (GMT)
committerdgp <dgp@users.sourceforge.net>2006-05-04 12:55:49 (GMT)
commit71536416ed0e6ce72d256d64c61ac0ecf23df29e (patch)
treecba1f9b31b18f6794aa9c4098ddb6bd320e4d2d6
parent2840d97d6aed2d51eb86b9f7ebde9e0f328de61d (diff)
downloadtcl-71536416ed0e6ce72d256d64c61ac0ecf23df29e.zip
tcl-71536416ed0e6ce72d256d64c61ac0ecf23df29e.tar.gz
tcl-71536416ed0e6ce72d256d64c61ac0ecf23df29e.tar.bz2
* generic/tclBasic.c (ExprSrandFunc): Restore acceptance of wide/big
* doc/mathfunc.n: integer values by srand() [Bug 1480509].
-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);
}
/*