Mailing-List: contact cygwin-help@sourceware.cygnus.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@sources.redhat.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@sources.redhat.com>
List-Help: <mailto:cygwin-help@sources.redhat.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@sources.redhat.com
Delivered-To: mailing list cygwin@sources.redhat.com
Message-Id: <m14BLkq-005FNCC@smtp.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>
Date: Wed, 27 Dec 2000 20:55:10 +0200
Reply-To: "Ulrich Jakobus" <u.jakobus@web.de>
X-Mailer: PMMail 2000 Professional (2.10.2010) For Windows 2000 (5.0.2195;1)
MIME-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Subject: cygwin/newlib bug in printf with %f format

Hello,

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

     0.000
     0.000
     1.000
     1.000

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

     0.000
     0
     1.000
     1.000

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!

Ulrich





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

