delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/03/07/11:09:36

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <422C7C8D.5080801@gamma-rs.ch>
Date: Mon, 07 Mar 2005 17:08:45 +0100
From: "Charles L. Werner" <cw AT gamma-rs DOT ch>
Reply-To: cw AT gamma-rs DOT ch
Organization: Gamma Remote Sensing AG
User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: error in scanf reading %le format and 00 exponent

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019