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

Re: Re: Filthy Floats

by Hofmator (Curate)
on Jul 16, 2001 at 20:53 UTC ( [id://97084]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    printf "%.3f => %.2f\n", 1.023, 1.023;
    printf "%.3f => %.2f\n", 1.026, 1.026;
    
    #prints
    1.023 => 1.02
    1.026 => 1.03
    
  2. or download this
    printf "%.5f => %.2f\n", 1.025, 1.025;
    
    # prints instead of the correct 1.03
    1.025 => 1.02
    
  3. or download this
    printf "%.5f => %.2f\n", 1.025+1e-10, 1.025+1e-10;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (2)
As of 2024-04-26 04:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found