Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: Clean log_10 ?

by LanX (Saint)
on Nov 28, 2019 at 17:15 UTC ( [id://11109380]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11109380]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2024-04-16 09:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found