[Openmcl-devel] = fails for integers with the same printed representation on 32bit CCL
R. Matthew Emerson
rme at clozure.com
Mon Jan 9 21:28:06 PST 2017
Filed as http://trac.clozure.com/ccl/ticket/1403
I don't think = is the problem. It seems more likely to me that cl:random is returning a bignum with too many bignum digits.
Thanks for the report.
> On Jan 8, 2017, at 7:51 PM, Anton Vodonosov <avodonosov at gmail.com> wrote:
>
> Hello,
>
> I reduced the use case to the following
>
> (defparameter *rnd-state* (make-random-state t))
>
> (dotimes (i 300000)
> (let* ((rand-val (random #.(1- (expt 2 64)) *rnd-state*))
> (read-val (read-from-string (with-output-to-string (o)
> (pprint rand-val o)))))
> (assert (= rand-val read-val)
> nil
> "rand-val: ~S, read-val: ~S" rand-val read-val)))
>
>
> ;; it doesn't fail from the first time, try 2-3 times more
>
> At some point assert fails and the message is:
>
> rand-val: 1037244565857250958, read-val: 1037244565857250958
> [Condition of type SIMPLE-ERROR]
>
> Inspecting the variables in SLIME debuggers shows this:
>
>
> RAND-VAL:
>
> #<(INTEGER 536870912) #xE65086FE5202E8E>
> --------------------
> Value: 1037244565857250958 = #xE65086FE5202E8E = #o71450206774510027216 = #b1110 01100101 00001000 01101111 11100101 00100000 00101110 10001110 = 1.0260616E+19
> Integer-length: 64
>
>
>
> READ-VAL:
>
> #<(INTEGER 536870912) #xE65086FE5202E8E>
> --------------------
> Value: 1037244565857250958 = #xE65086FE5202E8E = #o71450206774510027216 = #b1110 01100101 00001000 01101111 11100101 00100000 00101110 10001110 = 1.0372446E+18
> Integer-length: 60
>
>
> As you see, it prints the same binary representation, but Integer-length: 64 vs Integer-length: 60
>
>
> Is it a CCL bug?
More information about the Openmcl-devel
mailing list