Closed sageserpent-open closed 2 years ago
This was due to an integer overflow in the calculation of the updated starvation countdown value when streaming cases in TrialsImplementation
- had written a naive Math.sqrt(limit * remainingGap)
, being blissfully ignorant of the possibility of integer overflow prior to the promotion to a double value in the call to Mathsqrt
. Rookie mistake.
What is surprising was that no exception was thrown - the NaN yielded by Math.sqrt
is subsequently quietly converted to a zero - this was what caused the abrupt cessation of new cases.
Have added a test to reproduce this problem, this failed, have put in a bug fix and it now passes.
This has gone out in release 1.4.1, Git commit SHA c6573a9 .
Retried the JShell reproduction above, now prints the correct value of 100000 when using release 1.4.1 of Americium.
Reproduction via JShell:
The expected count of invocations should be 100000 (or possibly a value close to that, as there might be the odd collision between cases, given that they are randomly generated).
What is printed as per Git commit: f8c9f6a1ed04e45620e2f4464dcda852c5767907 (release 1.4.0) is 14102.
What is stopping at least roughly the required number of cases from being generated?
The same lack of supplied cases is also exhibited if
api.doubles()
is used to supply the cases - again, only 14102 cases are supplied.Writing a custom case factory like this:
Still results in 14102 cases being supplied.
Maybe whatever generates the inputs that drive the case factories is cycling through a limited set of long integer values?