[u.jakobus@web.de: cygwin/newlib bug in printf with %f format]

Christopher Faylor cgf@redhat.com
Wed Dec 27 10:58:00 GMT 2000

----- Forwarded message from Ulrich Jakobus <u.jakobus@web.de> -----

From: "Ulrich Jakobus" <u.jakobus@web.de>
To: "cygwin@sourceware.cygnus.com" <cygwin@sourceware.cygnus.com>
Cc: "Johann van Tonder" <jvtonder@emss.co.za>
Subject: cygwin/newlib bug in printf with %f format
Date: Wed, 27 Dec 2000 20:55:10 +0200
Reply-To: "Ulrich Jakobus" <u.jakobus@web.de>


when printing floating point numbers which are very small
but not exactly zero using the %f format of printf, then 
since cygwin-1.1.5-6 (also still in recent cygwin-1.1.7) 
there is a formatting bug. cygwin-1.1.4 and earlier versions
were fine (I did not test versions between 1.1.4 and 1.1.5-6,
so I cannot tell precisely since when the problem exists).

To illustrate the problem, just compile the following code:

#include <stdio.h>
int main()
  printf ("%10.3f\n", 0.0);
  printf ("%10.3f\n", 0.0+1.0e-12);
  printf ("%10.3f\n", 1.0);
  printf ("%10.3f\n", 1.0+1.0e-12);

Output of this sample code should be


but with cygwin1.dll since version 1.1.5-6 it actually is


i.e. the second line is too short, the last four characters ".000"
are missing (this is very irritating when printing tables, since
all output following on the same line is shifted).

Could someone please try to identify this problem and fix
it? I just guess that it might be in libc/stdio/vfprintf.c
but am not sure.

Thanks very much and season greetings!


Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

----- End forwarded message -----

cgf@cygnus.com                        Red Hat, Inc.
http://sources.redhat.com/            http://www.redhat.com/

More information about the Newlib mailing list