Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: (s)printf and rounding woes

by pg (Canon)
on Nov 04, 2003 at 23:49 UTC ( [id://304581]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #include <stdio.h>
    
    ...
        float x = 147.2;
        printf("%20.20f", x * 100);
    }
    
  2. or download this
    float x = 147.2;
    printf("%d", x * 100);
    
  3. or download this
    $x = 147.2;
    printf("%d", $x * 100);
    
  4. or download this
    float x = 147.2;
    printf("%d", (int)(x * 100));
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (7)
As of 2024-03-29 11:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found