Subject: error in scanf reading %le format and 00 exponent
From: "Charles L. Werner" <[email-masked]>
To: [email-masked]
Date: Mon, 07 Mar 2005 17:08:45 +0100

Hi,

I seem to have detected a serious error (for me of course...)
in the current cygwin 1.5.13 library.  The minus sign of input values  with a e+00 exponent, for example
-1.1e+00  fail to read the minus sign. Here is a short program rdf.c that demonstrates the
problem. Compiled with

gcc rdf.c -o rdf.exe

#include <stdio.h>
main()
{
   double a;
   while(1){
     printf("input: ");
     scanf("%le",&a);
     printf("a: %le\n",a);
   }
}

Here are some examples that show the bug:

$ rdf
input: -.11e+00
a: 1.100000e-01   !akkk

input: -1.1e+00
a: 1.100000e+00   !akkk

input: -1.1e00
a: 1.100000e+00  !akkk

input: -11e-01
a: -1.100000e+00  !akkk

input: -.11E+01   !ok
a: -1.100000e+00

input: -11e-01    !ok
a: -1.100000e+00

So the problem seems to be related to the case where the exponent is 00.

What is to be done?

Thanks

Charles

-- 
Dr. Charles L. Werner
Gamma Remote Sensing AG
Worbstr. 225
CH-3073 Gümligen, Switzerland

Tel: +41 31 951 70 05
FAX: +41 31 951 70 08
http://www.gamma-rs.ch

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/