You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The regression diff -y finds a difference in average, standard deviation, etc. of Gen.int whereas the remaining generators reveal the exact same distribution:
I believe this is expected, since QCheck2.Gen.int relies on a reworked pint generator from bdfc905. The two underlying implementations look very much the same if one compares QCheck:
(* Uniform random int generator *)let pint =ifSys.word_size =32thenfunst -> RS.bits st
else(* word size = 64 *)funst ->
RS.bits st (* Bottom 30 bits *)lor (RS.bits st lsl30) (* Middle 30 bits *)lor ((RS.bits st land3) lsl60) (* Top 2 bits *)(* top bit = 0 *)
to QCheck2:
letpint_raw (st: RS.t) : int =ifSys.word_size =32thenRS.bits st
else(* word size = 64 *)(* Bottom 30 bits *)let right =RS.bits st in(* Middle 30 bits *)let middle = (RS.bits st lsl30) in(* Technically we could write [3] but this is clearer *)let two_bits_mask =0b11in(* Top 2 bits *)let left = ((RS.bits st land two_bits_mask) lsl60) in
left lor middle lor right
As far as I can tell, it is better documented (yay!) and the call order to RS.bits is fixed with let-bindings (also yay!). As such, I suspect the difference is actually caused by our good old friend - unspecified evaluation order of function calls 😬
With right-to-left evaluation I thus suspect the QCheck version generates the top, middle, bottom parts in that order, whereas QCheck2 enforces a bottom, middle, top order. Here I think QCheck should follow suit:
relying on the evaluation order is bad for reproducability
there would be no diff -y for the Gen.int distribution (like all other stat tests so far)
The regression
diff -y
finds a difference in average, standard deviation, etc. ofGen.int
whereas the remaining generators reveal the exact same distribution:I believe this is expected, since
QCheck2.Gen.int
relies on a reworkedpint
generator frombdfc905. The two underlying implementations look very much the same if one compares QCheck:
to QCheck2:
As far as I can tell, it is better documented (yay!) and the call order to
RS.bits
is fixed withlet
-bindings (also yay!). As such, I suspect the difference is actually caused by our good old friend - unspecified evaluation order of function calls 😬With right-to-left evaluation I thus suspect the
QCheck
version generates the top, middle, bottom parts in that order, whereas QCheck2 enforces a bottom, middle, top order. Here I think QCheck should follow suit:diff -y
for theGen.int
distribution (like all other stat tests so far)Originally posted by @jmid in #153 (comment)
The text was updated successfully, but these errors were encountered: