B
Brian Schroeder
Hello Group,
I wondered, why there is no log2 function in Math. I expected
Math.log = log2 and
Math.ln = log_e.
And spend some time searching for the bug in my algorithm that used log2.
Now I use
module Math
def log2(n)
Math.log(n) * 1.0 / Math.log(2)
end
end
But this seems quite ugly to me. Is there a reason that log2 is missing,
or have I overlooked something.
Regards,
Brian
I wondered, why there is no log2 function in Math. I expected
Math.log = log2 and
Math.ln = log_e.
And spend some time searching for the bug in my algorithm that used log2.
Now I use
module Math
def log2(n)
Math.log(n) * 1.0 / Math.log(2)
end
end
But this seems quite ugly to me. Is there a reason that log2 is missing,
or have I overlooked something.
Regards,
Brian