Get the base 2 logarithm of abs(num), rounded down to the nearest integer.
smartOp.ilogb(0) will raise IntFlag.undef.
1 import checkedint.sticky : smartOp; 2 3 assert(smartOp.ilogb(20) == 4); 4 assert(smartOp.ilogb(-20) == 4); 5 6 smartOp.ilogb(0); 7 assert(IntFlags.local.clear() == IntFlag.undef);
See Implementation
Get the base 2 logarithm of abs(num), rounded down to the nearest integer.
smartOp.ilogb(0) will raise IntFlag.undef.