Index: usr.bin/seq/seq.c =================================================================== --- usr.bin/seq/seq.c +++ usr.bin/seq/seq.c @@ -80,7 +80,9 @@ int equalize = 0; double first = 1.0; double last = 0.0; + double cur; double incr = 0.0; + double step; struct lconv *locale; char *fmt = NULL; const char *sep = "\n"; @@ -163,22 +165,16 @@ if (!valid_format(fmt)) errx(1, "invalid format string"); /* - * XXX to be bug for bug compatible with Plan 9 add a + * XXX to be bug for bug compatible with Plan 9 add a * newline if none found at the end of the format string. */ } else fmt = generate_format(first, incr, last, equalize, pad); - if (incr > 0) { - for (; first <= last; first += incr) { - printf(fmt, first); - fputs(sep, stdout); - } - } else { - for (; first >= last; first += incr) { - printf(fmt, first); - fputs(sep, stdout); - } + for (step = 1, cur = first; incr > 0 ? cur <= last : cur >= last; + cur = first + incr * step++) { + printf(fmt, cur); + fputs(sep, stdout); } if (term != NULL) fputs(term, stdout);