BUG: improve log2 windows compiler fallback of log2

Fallback (similar to python3.4 math.log2) provides int(log(2**i)) == i
in default rounding mode.
Non-default rounding modes not tested but if it does not work we are at
least not worse than python.
Closes gh-4787
Note that `int` truncates, it doesn't round. The `v == i` check works for gcc on linux, but as you say, might be a bit strict for some libraries.