OSDN Git Service

stdio: Fix printing 0.0
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Mon, 15 Dec 2014 15:13:01 +0000 (16:13 +0100)
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Mon, 15 Dec 2014 16:27:49 +0000 (17:27 +0100)
commitf8e05f3850e51673522216f23533bf7146359dcd
tree388ffe38b5648af914bf0c9272f1768982f441bf
parent067637375658047d70c296606ae17ef0bc86499d
stdio: Fix printing 0.0

We were relying on FE_DIVBYZERO being turned off when printing
"%f", +-.0
Avoid the whole issue by looking at the sign-bit (in a rough
approximation).

Note that we do not handle gracefully:
  printf ("\n%llf\n", -0.0);
  printf ("\n%llf\n",  0.0);
nor %Lf for both when NOT cast to long double. Avoiding an FPE due to
broken numbers like these does not make sense to me.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
libc/stdio/_fpmaxtostr.c