Commit d4cb5a5e authored by rtoy's avatar rtoy
Browse files

code/rand-mt19937.lisp:

o Recursively call RANDOM for the integer case to let the deftransform
  handle the case.

compiler/float-tran.lisp:
o Remove comment about modifying RANDOM to match the deftransform.
  We're automatically in sync now.
parent 760f82a0
......@@ -6,7 +6,7 @@
;;; placed in the Public domain, and is provided 'as is'.
;;;
(ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/rand-mt19937.lisp,v 1.16 2008/06/24 17:27:51 rtoy Exp $")
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/rand-mt19937.lisp,v 1.17 2008/06/26 21:00:24 rtoy Exp $")
;;;
;;; **********************************************************************
;;;
......@@ -444,15 +444,8 @@
#+long-float %long-float))
(cond
((typep arg '(integer 1 #x100000000))
;; Basically, pretend (random-chunk) produces a 32-bit fractional
;; number, multiply by arg, and take the integer part.
;;
;; WARNING: If you change this be sure to make the deftransform
;; for RANDOM in float-tran.lisp does the same thing.
(if (= arg #x100000000)
(random-chunk state))
(values (bignum::%multiply (random-chunk state)
arg)))
;; Let the compiler deftransform take care of this case.
(random arg state))
((and (typep arg 'single-float) (> arg 0.0F0))
(%random-single-float arg state))
((and (typep arg 'double-float) (> arg 0.0D0))
......
......@@ -5,7 +5,7 @@
;;; Carnegie Mellon University, and has been placed in the public domain.
;;;
(ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/float-tran.lisp,v 1.120 2008/06/24 17:27:51 rtoy Exp $")
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/float-tran.lisp,v 1.121 2008/06/26 21:00:25 rtoy Exp $")
;;;
;;; **********************************************************************
;;;
......@@ -255,10 +255,6 @@
;; it were a 32-bit fraction between 0 and 1, exclusive. Multiply
;; this by num-high to get a random number between 0 and num-high,
;; This should have no bias.
;;
;; WARNING: If you change this, be sure to look at the definition
;; of RANDOM so that it produces the same value as the
;; deftransform would produce.
(cond ((constant-continuation-p num)
(if (= num-high (expt 2 32))
'(random-chunk (or state *random-state*))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment