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
I create a lot of IntervalNode objects and eventually this error pops up
File "intersection.pyx", line 395, in bx.intervals.intersection.IntervalTree.insert (lib/bx/intervals/intersection.c:4902)
File "intersection.pyx", line 127, in bx.intervals.intersection.IntervalNode.insert (lib/bx/intervals/intersection.c:1657)
File "intersection.pyx", line 118, in bx.intervals.intersection.IntervalNode.insert (lib/bx/intervals/intersection.c:1567)
File "intersection.pyx", line 118, in bx.intervals.intersection.IntervalNode.insert (lib/bx/intervals/intersection.c:1567)
File "intersection.pyx", line 118, in bx.intervals.intersection.IntervalNode.insert (lib/bx/intervals/intersection.c:1567)
File "intersection.pyx", line 118, in bx.intervals.intersection.IntervalNode.insert (lib/bx/intervals/intersection.c:1567)
File "intersection.pyx", line 118, in bx.intervals.intersection.IntervalNode.insert (lib/bx/intervals/intersection.c:1567)
File "intersection.pyx", line 118, in bx.intervals.intersection.IntervalNode.insert (lib/bx/intervals/intersection.c:1567)
File "intersection.pyx", line 127, in bx.intervals.intersection.IntervalNode.insert (lib/bx/intervals/intersection.c:1657)
File "intersection.pyx", line 118, in bx.intervals.intersection.IntervalNode.insert (lib/bx/intervals/intersection.c:1567)
File "intersection.pyx", line 127, in bx.intervals.intersection.IntervalNode.insert (lib/bx/intervals/intersection.c:1657)
File "intersection.pyx", line 127, in bx.intervals.intersection.IntervalNode.insert (lib/bx/intervals/intersection.c:1657)
File "intersection.pyx", line 120, in bx.intervals.intersection.IntervalNode.insert (lib/bx/intervals/intersection.c:1600)
File "intersection.pyx", line 91, in bx.intervals.intersection.IntervalNode.__cinit__ (lib/bx/intervals/intersection.c:1330)
ZeroDivisionError: float division
The issue seems to be that at self.priority = ceil(nlog * log(-1.0/(1.0 * rand()/RAND_MAX - 1)))
I assume rand() can produce 0 or RAND_MAX, at which point (1.0 * rand()/RAND_MAX - 1) equals 0, hence ZeroDivisionError is thrown
The text was updated successfully, but these errors were encountered:
Right. The comment above the failing line claims that "python's uniform is perfect since the upper limit is not inclusive". But rand() isn't from python, it's from C. And the C standard says rand() is inclusive, 0<=rand()<=RAND_MAX.
I think the question is whether the intent was to have (RAND_MAX+1) as the denominator instead of RAND_MAX. That comment makes me think python's random.random() used to be used here.
Secondary questions would be (a) why the C PRNG is being used instead of the python PRNG, since C rand() implementations are usually poor, and (b) why a binomial distribution is being used instead of uniform.
I create a lot of IntervalNode objects and eventually this error pops up
The issue seems to be that at
self.priority = ceil(nlog * log(-1.0/(1.0 * rand()/RAND_MAX - 1)))
I assume rand() can produce 0 or RAND_MAX, at which point (1.0 * rand()/RAND_MAX - 1) equals 0, hence ZeroDivisionError is thrown
The text was updated successfully, but these errors were encountered: