in reply to Re: Power of two round up.
in thread Power of two round up.

...and ln() is the natural logarithm

Note that it doesn't have to be the natural logarithm. You can use a log to any base.
D:\>perl -MPOSIX="log10,log2" -le "$r1=log(1234)/log(2);$r2=log10(1234 +)/log10(2);$r3=log2(1234)/log2(2);print $r1; print $r2; print $r3;" 10.269126679149417887862906163471 10.269126679149417887862906163471 10.269126679149417887862906163471
Cheers,
Rob

Replies are listed 'Best First'.
Re^3: Power of two round up.
by c-alpha (Novice) on Sep 22, 2023 at 12:53 UTC

    You can use a log to any base, indeed, for as long as you use the same base for both dividend and divisor.

    And, coincidentally, the log to the base Euler's number is the only one one available as part of core Perl. So as to minimize the readers' confusion, I opted to using that.