Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Is this odd behavior a floating point problem?

by Eliya (Vicar)
on Mar 23, 2012 at 17:14 UTC ( #961266=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $ perl -e '$x=0.001; $sum += $x for 1..40; printf "%.20f", $sum/40'
    0.00100000000000000067
    
  2. or download this
    $ perl -e '$x=0.001; $sum += $x for 0..40; printf "%.20f", $sum/40'
    0.00102500000000000074
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (12)
As of 2014-11-24 16:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (143 votes), past polls