Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: floating points and sprintf

by Zaxo (Archbishop)
on Nov 14, 2002 at 15:31 UTC ( [id://212866]=note: print w/replies, xml ) Need Help??


in reply to floating points and sprintf

Wrong format, he wants '%e' or '%f'.

Oops, replied to the title. Decimal representation of binary fractions problen, see 'perldoc -q round' from perlfaq4..

After Compline,
Zaxo

Replies are listed 'Best First'.
Re: Re: floating points and sprintf
by kennethwlangley (Novice) on Nov 14, 2002 at 15:35 UTC
    Not if he wants to convert a float to an int (check my quote from the perlfunc document). I forgot to include a table of results. Here it is:
    $ ./chksprintf.pl
    147    14700    14700    14700
    147.1  14710    14710    14710
    147.2  14720    14720    14719
    147.3  14730    14730    14730
    147.4  14740    14740    14740
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2024-04-23 17:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found