Julia 1.1.0
julia> leading_zeros(BigInt(1))
ERROR: MethodError: no method matching leading_zeros(::BigInt)
trailing_zeros(::BigInt) is defined so I think it makes sense that leading_zeros(::BigInt) is also defined.
But what is the correct answer to leading_zeros(BigInt(1))?
It should return 63.
i.e. for BigInt x: leading_zeros(unsafe_load(x.d, abs(x.size)))
But I am not sure what should be the behavior for -ve BigInts.
I think that's questionable; it feels like leaking an implementation detail (the size of limbs used to represent BigInts).
Agree. I had not considered that before. Shall I close this issue then?
Most helpful comment
But what is the correct answer to
leading_zeros(BigInt(1))?