error in scanf reading %le format and 00 exponent
Charles L. Werner
cw@gamma-rs.ch
Mon Mar 7 16:58:00 GMT 2005
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/
More information about the Cygwin
mailing list