http://www.perlmonks.org?node_id=1210898


in reply to Re^4: Portability of floor(log(N))
in thread Portability of floor(log(N))

Using POSIX::log10() looks like the simplest solution. I will attempt to pester the tester with a modified version of FormatEng.pm.

Do you think I can simplify it by replacing POSIX::log10(1000) with 3, or will it be better to keep your code as-is?

my $e = floor( POSIX::log10($num) / 3 );