Browse Source

avoid raising spurious division-by-zero exception in printf

Rich Felker 12 years ago
parent
commit
776251867d
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/stdio/vfprintf.c

+ 1 - 1
src/stdio/vfprintf.c

@@ -200,7 +200,7 @@ static int fmt_fp(FILE *f, long double y, int w, int p, int fl, int t)
 	char ebuf0[3*sizeof(int)], *ebuf=&ebuf0[3*sizeof(int)], *estr;
 
 	pl=1;
-	if (y<0 || 1/y<0) {
+	if (signbit(y)) {
 		y=-y;
 	} else if (fl & MARK_POS) {
 		prefix+=3;