Is there any way to write log2() function?
The C language has 2 built in functions
log
which is base e.log10
base 10;But I need log function of base 2. How to calculate this?
Simple math:
log2 (x) = logy (x) / logy (2)
where y can be anything, which for standard log functions is either 10 or e.