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

Re^3: sprintf rounding convention

by kennethk (Abbot)
on Oct 30, 2009 at 22:24 UTC ( [id://804228]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $ perl -v
    
    ...
    $ perl -e 'printf "%.2f\n%.2f\n", 0.335, 1.335;'
    0.34
    1.33
    
  2. or download this
    
    C:\>perl -v
    ...
    C:\>perl -e "printf qq{%.2f\n%.2f\n}, 0.335, 1.335;"
    0.34
    1.34
    
  3. or download this
    $ perl -v
    
    This is perl, v5.8.8 built for x86_64-linux-gnu-thread-multi
    ...
    C:\>perl -e "printf qq{%.40f\n%.40f\n}, 0.335, 1.335;"
    0.3350000000000000200000000000000000000000
    1.3350000000000000000000000000000000000000
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (4)
As of 2024-05-28 22:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found