[Openmcl-devel] = fails for integers with the same printed representation on 32bit CCL

Anton Vodonosov avodonosov at gmail.com
Sun Jan 8 19:51:02 PST 2017


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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20170109/b3d3e830/attachment.htm>


More information about the Openmcl-devel mailing list