Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: int($x) gives strange result

by busunsl (Vicar)
on Aug 24, 2009 at 06:31 UTC ( #790751=note: print w/ replies, xml ) Need Help??


in reply to int($x) gives strange result

If you just want to cut off decimal places you can use the sprintf function:

$x = sprintf('%.2f', $x);


Comment on Re: int($x) gives strange result
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (11)
As of 2014-10-02 14:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (61 votes), past polls