[m-rev.] time additions (was Re: for review: Add random.init/3)

Julien Fischer jfischer at opturion.com
Mon Jun 6 11:09:41 AEST 2016


Hi Mark,

On Sat, 4 Jun 2016, Mark Brown wrote:

> On Sun, May 29, 2016 at 7:55 PM, Julien Fischer <jfischer at opturion.com> wrote:
>> On Sun, 29 May 2016, Mark Brown wrote:
>>> As an aside, note that the tausworthe3 generator mentioned (which I
>>> think is the one from extras/gator) fails almost all of the dieharder
>>> tests on 64-bit platforms, which is a slight bug. Looking at the code,
>>> it seems that 64-bit platforms would need to truncate values to 32
>>> bits after some of the left-shift operations, since this is what would
>>> happen on on a 32-bit platform.
>>
>>
>> That's not surprising -- the original author of that implementation
>> wasn't working on a 64-bit machine when he wrote it.
>
> It also performs an arithmetic shift instead of a logical one, which
> would affect the behaviour on 32-bit machines.

Mercury is unfortunately at bit of a PITA for implementing things that
are sensitive to the signedeness and/or size of ints.   (You can do it,
of course, but it has does have a tendency to be quite error prone, as
the above demonstrates.)

We should probably add an equivalent to Java's '>>>' operator (i.e.
a logical right shift), which would help somewhat in these cases.

Julien.


More information about the reviews mailing list