The implementation of log2 is slow and sometimes loops forever, it should be a Java primitive instead.

Submitted by Gabriël Konat on 7 May 2014 at 14:24

On 7 May 2014 at 14:24 Gabriël Konat tagged error

On 7 May 2014 at 15:18 Arjen commented:

It looped forever on input 0. This naieve implementation of log2 does not handle that edge case properly, such that a repeated division by 2 will never fail, causing an infinite loop.


On 7 May 2014 at 15:33 Arjen commented:

And to be precise, “slow” means that it is O(n)!!

Log in to post comments