diff -r 172527f61bd3 seq.c
--- a/seq.c	Mon Apr 16 21:48:50 2012 +0200
+++ b/seq.c	Mon Apr 16 16:34:20 2012 -0500
@@ -30,12 +30,12 @@
 	char *exp;
 	int shift;
 
-	if (d[0] == '-' || d[0] == '+')
+	if (d[0] == '+')
 		d++;
 	exp = strpbrk(d, "eE");
 	shift = exp? atoi(exp+1) : 0;
 
-	return MAX(0, strspn(d, "0123456789")+shift);
+	return MAX(0, strspn(d, "-0123456789")+shift);
 }
 
 int
@@ -44,8 +44,6 @@
 	char *exp;
 	int shift, after;
 
-	if (d[0] == '-' || d[0] == '+')
-		d++;
 	exp = strpbrk(d, "eE");
 	shift = exp ? atoi(exp+1) : 0;
 	after = (d = strchr(d, '.'))? strspn(d+1, "0123456789") : 0;
@@ -59,8 +57,8 @@
 	regex_t reg;
 	int ret;
 
-	regcomp(&reg, "\\([^%]|%%\\)*%[0-9]*\\.[0-9]*[fFgG]"
-			"\\([^%]|%%\\)*", REG_NOSUB);
+	regcomp(&reg, "^([^%]|%%)*%[ +-]?[0-9]*\\.?[0-9]*[fFgGeE]"
+			"([^%]|%%)*$", REG_NOSUB|REG_EXTENDED);
 	ret = regexec(&reg, fmt, 0, NULL, 0);
 	regfree(&reg);
 
@@ -72,7 +70,7 @@
 {
 	char c, *fmt, ftmp[4096], *sep, *starts, *steps, *ends;
 	bool wflag, fflag;
-	double start, step, end, out;
+	double start, step, end, out, dir;
 	int left, right;
 
 	sep = "\n";
@@ -101,7 +99,6 @@
 			break;
 		}
 	}
-
 	if (wflag && fflag)
 		eprintf("-f and -w cannot be combined.\n");
 
@@ -134,21 +131,14 @@
 	start = atof(starts);
 	step = atof(steps);
 	end = atof(ends);
+	dir = (step>0)?1.0:-1.0;
 
 	if (step == 0)
 		return EXIT_FAILURE;
+	if (start*dir > end*dir)
+		return EXIT_FAILURE;
 
-	if (start > end) {
-		if (step > 0)
-			return EXIT_FAILURE;
-	} else if (start < end) {
-		if (step < 0)
-			return EXIT_FAILURE;
-	}
-
-	right = MAX(digitsright(starts),
-			MAX(digitsright(ends),
-				digitsright(steps)));
+	right = MAX(digitsright(starts), digitsright(steps));
 	if (wflag) {
 		left = MAX(digitsleft(starts), digitsleft(ends));
 
@@ -161,23 +151,11 @@
 
 	for (out = start;;) {
 		printf(fmt, out);
-
 		out += step;
-		if (start > end) {
-			if (out >= end) {
-				printf("%s", sep);
-			} else {
-				break;
-			}
-		} else if (start < end) {
-			if (out <= end) {
-				printf("%s", sep);
-			} else {
-				break;
-			}
-		} else {
+		if(out*dir <= end*dir)
+			printf("%s", sep);
+		else 
 			break;
-		}
 	}
 	printf("\n");
 
