Patrick Amstutz scripsit: > $ echo `seq 0.0 0.1 0.8` > 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 > $ echo `seq 0.0 0.1 0.9` > 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8
Welcome to floating-point roundoff errors. The decimal constant 0.1 cannot be exactly represented as a floating-point number on modern hardware, so 0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1 is actually greater than 0.9; consequently, 0.9 is not printed. You should never iterate using floating-point fractions for this reason. -- Where the wombat has walked, John Cowan <[EMAIL PROTECTED]> it will inevitably walk again. http://www.ccil.org/~cowan _______________________________________________ Bug-coreutils mailing list [email protected] http://lists.gnu.org/mailman/listinfo/bug-coreutils
