Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Removing decimals in number

by sacked (Hermit)
on May 14, 2004 at 19:08 UTC ( [id://353458]=note: print w/replies, xml ) Need Help??


in reply to Removing decimals in number

You can also use printf:
printf "%d" => 141.32124355465 # prints 141

--sacked

Replies are listed 'Best First'.
Re: Re: Removing decimals in number
by duff (Parson) on May 14, 2004 at 21:26 UTC
    Except that doesn't always work:
    $ perl -e 'printf "%d\n", 141.999999999999999' 142
    int is the right way to go. Or even POSIX::floor

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2024-04-19 20:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found