in reply to Re^7: Infinity and Inf? (MAX_INT)
in thread Infinity and Inf?
Nit: C-Style for doesn't handle that very well. STEP 0.5 is ok since it's a sum of powers of 2 (2-1), but let's take STEP 0.1 instead:
$ perl -E'for (my $_=0; $_<=7; $_+=0.1) { say }' ... 5.6 5.7 5.8 5.9 5.99999999999999 6.09999999999999 6.19999999999999 6.29999999999999 6.39999999999999 6.49999999999999 6.59999999999999 6.69999999999999 6.79999999999999 6.89999999999999 6.99999999999999
Generate the floats from integers to avoid compounding errors:
$ perl -E'for (0..70) { say $_/10 }' ... 5.6 5.7 5.8 5.9 6 6.1 6.2 6.3 6.4 6.5 6.6 6.7 6.8 6.9 7
|
|---|