Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Rounding a number using (s)printf

by borisz (Canon)
on Jan 19, 2005 at 22:36 UTC ( [id://423535]=note: print w/replies, xml ) Need Help??


in reply to Rounding a number using (s)printf

Floating point numbers are not exactly represented.
perl -e 'printf "%.18f", 1.255' __OUTPUT__ 1.254999999999999893
so 1.25 is the correct result.
Boris

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2024-04-26 01:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found