diff options
author | Jim Meyering <jim@meyering.net> | 1996-04-07 16:59:12 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1996-04-07 16:59:12 +0000 |
commit | 45c51b256aa11649a0598d4a5302d304087a5d19 (patch) | |
tree | 79cba91c1342c9b96f5c7a971649c12548eb99dd | |
parent | c1505fc01f46bdb0e4f6e719a05b7cccf40c53e2 (diff) | |
download | coreutils-45c51b256aa11649a0598d4a5302d304087a5d19.tar.xz |
(main): Rearrange loops to get it right.
Reported by Karl Eichwalder <ke@ke.Central.DE>.
-rw-r--r-- | src/seq.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -399,15 +399,16 @@ print_numbers (const char *format_str) /* NOTREACHED */ } + printf (format_str, first); for (i = 0; /* empty */; i++) { double x = first + i * step; - printf (format_str, x); - if (x <= last) + if (x < last) break; fputs (separator, stdout); + printf (format_str, x); } } else @@ -421,15 +422,16 @@ print_numbers (const char *format_str) /* NOTREACHED */ } - for (i = 0; /* empty */; i++) + printf (format_str, first); + for (i = 1; /* empty */; i++) { double x = first + i * step; - printf (format_str, x); - if (x >= last) + if (x > last) break; fputs (separator, stdout); + printf (format_str, x); } } fputs (terminator, stdout); |