I see a log and log10,in math.h, but how do I log base 2 ?
I see a log and log10,in math.h, but how do I log base 2 ?
I believe you can use mathematics, i.e., the change of base formula.
log_b(a) = log_c(a) / log_c(b)
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
You can easily calculate a log in base x by doing:
log (base x) (y) = log (y) / log (x)
edit: damn ... too slow ...