From 45c51b256aa11649a0598d4a5302d304087a5d19 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 7 Apr 1996 16:59:12 +0000 Subject: (main): Rearrange loops to get it right. Reported by Karl Eichwalder . --- src/seq.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/seq.c b/src/seq.c index 3cddcca58..c8997ce5c 100644 --- a/src/seq.c +++ b/src/seq.c @@ -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); -- cgit v1.2.3-70-g09d2