]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
seq: say why not ‘x += step’
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 29 Jan 2024 07:35:49 +0000 (23:35 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 29 Jan 2024 07:36:17 +0000 (23:36 -0800)
* src/seq.c (print_numbers): Add comment.

src/seq.c

index 3d2c1c2ea2c553fefeb40dc22c12422caecc3063..ad16f27018403ba041cdf7b941fa26f9b75b2bad 100644 (file)
--- a/src/seq.c
+++ b/src/seq.c
@@ -307,7 +307,11 @@ print_numbers (char const *fmt, struct layout layout,
             write_error ();
           if (out_of_range)
             break;
+
+          /* Mathematically equivalent to 'x += step;', and typically
+             less subject to rounding error.  */
           x = first + i * step;
+
           out_of_range = (step < 0 ? x < last : last < x);
 
           if (out_of_range)