Subject: error in scanf handling of doubles
From: R Clint Whaley <[email-masked]>
To: [email-masked]
Cc: [email-masked], [email-masked]
Date: Wed, 9 May 2001 14:01:44 -0400 (EDT)

Hi,

I'm using Win2000 on a P4, using cygwin 1.3.1, gcc 2.95.3-4, downloaded
and installed today.  This version of cygwin does not perform correctly
with any of the scanf functions applied to floats.  Here is an example
routine demonstrating the error:

>#include <stdio.h>
>#include <assert.h>
>main(int nargs, char **args)
>{
>   char *str="-1106.743501";
>   double mf0, mf1;
>   if (nargs > 1) str = args[1];
>   assert(sscanf(str, "%lf", &mf1) == 1);
>   fprintf(stderr, "mf = '%s', %lf\n", str, mf1);
>   exit(0);
>}

Here is a compile and run on any other machine:
>drteeth.cs.utk.edu. gcc -o xerr showerr.c 
>drteeth.cs.utk.edu. ./xerr 
>mf = '-1106.743501', -1106.743501
>drteeth.cs.utk.edu. ./xerr 7.7
>mf = '7.7', 7.700000

Here it is on the cygwin1.3.1 box:
>$ ./xerr 
>mf = '-1106.743501', 1.000000
>$ ./xerr 7.7
>mf = '7.7', 77.000000

This worked under version 1.1.8 on the same machine/setup.  Can you confirm
the problem, so it's not just my install?

Any help much appreciated,
Clint

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