From: Rich Felker Date: Fri, 19 Oct 2012 00:26:41 +0000 (-0400) Subject: avoid raising spurious division-by-zero exception in printf X-Git-Tag: v0.9.7~27 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=776251867d07cca2866908186ef245f72596ce75;p=oweals%2Fmusl.git avoid raising spurious division-by-zero exception in printf --- diff --git a/src/stdio/vfprintf.c b/src/stdio/vfprintf.c index 6525938f..4a2752b2 100644 --- a/src/stdio/vfprintf.c +++ b/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;