Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Floating Point Looping In Perl

by ikegami (Patriarch)
on Aug 13, 2010 at 04:42 UTC ( [id://854823]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $ perl -e' printf "%.20f\n", 1.6;'
    1.60000000000000008882
    
  2. or download this
    $ perl -e'
       for ($i=1.1;$i<=1.6;$i+=.1) { printf "%.20f\n", $i; }
    ...
    1.50000000000000044409
    
    1.60000000000000053291
    
  3. or download this
    $ perl -le'for my $i (1..6) { print 1+$i/10 }'
    1.1
    ...
    1.4
    1.5
    1.6
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2024-04-18 02:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found