in reply to Re: Clean log_10 ?
in thread Clean log_10 ?

> > I'm interested to get the log10 of a whole number

> the log10 is going to be irrational

Yeah you're right.

Rewording: I need the correct int(log10) to reproduce the E notation of a whole number.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

Replies are listed 'Best First'.
Re^3: Clean log_10 ?
by dave_the_m (Monsignor) on Nov 28, 2019 at 19:48 UTC
    Do you mean that the number you are taking the log of will always be a power of 10? In which case, the log will be almost an integer, so round to nearest int: $power = int($log10 + 0.5);

    Otherwise, why not use sprintf "%e", $num or similar?

    Dave.