Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Message-ID: <000d01c10185$3b753620$8c05f63e@texas> Reply-To: "Marold Moosrainer" From: "Marold Moosrainer" To: Subject: gcc floating point problem with scanf Date: Sat, 30 Jun 2001 18:53:46 +0200 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0009_01C10195.FE1C31A0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2615.200 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 ------=_NextPart_000_0009_01C10195.FE1C31A0 Content-Type: multipart/alternative; boundary="----=_NextPart_001_000A_01C10195.FE1C31A0" ------=_NextPart_001_000A_01C10195.FE1C31A0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Dear cygwin team,=20 I cannot correctly input floating point numbers via scanf. I am using = gcc 2.95.3-4 as it is distributed by cygnus solutions. My machine is a = Pentium Win98 computer. Please find attached the requested cygcheck.out = file and below a code snip for the problem. I would be happy to get some = ideas.=20 Regards, Marold Command line: $ gcc scanf_float.c Source code: #include int main(void) { int i; float flt; double dbl; printf("Enter int: "); /* 55 */ scanf("%i", &i); printf("i=3D%i\n", i); /* 55, ok */ =20 printf("Enter float: "); /* 5.543 */ scanf("%f", &flt); printf("flt=3D%f\n", flt); /* 5543.000000, ERROR */ printf("Enter double: "); /* 5.543 */ scanf("%lf", &dbl); printf("dbl=3D%f\n", dbl); /* 5543.000000, ERROR */ =20 return 0; } ------=_NextPart_001_000A_01C10195.FE1C31A0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

Dear cygwin team,

I cannot correctly input floating point numbers via scanf. I am using = gcc=20 2.95.3-4 as it is distributed by cygnus solutions. My machine is a = Pentium Win98=20 computer. Please find attached the requested cygcheck.out file and below = a code=20 snip for the problem. I would be happy to get some ideas.

Regards, Marold

Command line:

$ gcc scanf_float.c

Source code:

#include <stdio.h>

int main(void)
{
      int=20 i;
      float=20 flt;
      double dbl;

      printf("Enter int: "); =     /*=20 55 */
      scanf("%i",=20 &i);
      printf("i=3D%i\n",=20 i);        /* 55, ok=20 */
     
     =20 printf("Enter float: ");     /* 5.543=20 */
      scanf("%f",=20 &flt);
      printf("flt=3D%f\n",=20 flt);    /* 5543.000000, ERROR */

      printf("Enter double:=20 ");      /* 5.543 = */
     =20 scanf("%lf", &dbl);
      = printf("dbl=3D%f\n",=20 dbl);    /* 5543.000000, ERROR=20 */
      
    &nb= sp;=20 return 0;
}

------=_NextPart_001_000A_01C10195.FE1C31A0-- ------=_NextPart_000_0009_01C10195.FE1C31A0 Content-Type: application/octet-stream; name="cygcheck.out" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="cygcheck.out" Cygnus Win95/NT Configuration Diagnostics Current System Time: Sat Jun 30 18:50:55 2001 Win9X Ver 4.10 build 67766446 A=20 Path: /usr/local/bin /usr/bin /bin /cygdrive/c/WINDOWS /cygdrive/c/WINDOWS /cygdrive/c/WINDOWS/COMMAND /cygdrive/c/PROGRAMME/MIKTEX/MIKTEX/BIN /cygdrive/c/PROGRAMME/ANSYS INC/ANSYS57/BIN/INTEL SysDir: C:\WINDOWS\SYSTEM WinDir: C:\WINDOWS PWD =3D `/home/standard' USER =3D `standard' MAKE_MODE =3D `unix' HOME =3D `/home/standard' PROMPT =3D `$p$g' COMSPEC =3D `C:\WINDOWS\COMMAND.COM' !C: =3D `C:\cygwin\bin' CMDLINE =3D `bash --login -i' HOSTNAME =3D `TEXAS' !D: =3D `D:\Eigene Dateien\C-Doku\C++FAQ' ANSYSLIC_DIR =3D `C:\PROGRAMME\ANSYS INC\SHARED FILES\LICENSING' WINDIR =3D `C:\WINDOWS' CTSYN =3D `C:\WINDOWS' ANSYS57_DIR =3D `C:\PROGRAMME\ANSYS INC\ANSYS57' WINBOOTDIR =3D `C:\WINDOWS' PS1 =3D `\[\033]0;\w\007 \033[32m\]\u@\h \[\033[33m\w\033[0m\] $ ' BLASTER =3D `A220 I7 D1 H5 P330 T6' MACHTYPE =3D `i686-pc-cygwin' OLDPWD =3D `/usr/bin' TEMP =3D `/cygdrive/c/windows/TEMP' SHLVL =3D `1' SHELL =3D `/bin/sh' HOSTTYPE =3D `i686' OSTYPE =3D `cygwin' TERM =3D `cygwin' _ =3D `/usr/bin/cygcheck' TZ =3D `MEZMZ-1MEZMS-2,M3.5.0/2,M10.5.0/3' HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Menu= Order\Start Menu\&Programs\Cygnus Solutions (default) =3D (unsupported type) HKEY_CURRENT_USER\Software\Cygnus Solutions HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2 (default) =3D `/cygdrive' cygdrive flags =3D 0x00000020 HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\Program Options HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0 HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\00 HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\01 HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\02 HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\03 HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\04 HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\05 HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\06 HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\07 HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\08 HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\09 HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\0A HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\0B HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\0C HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\0D HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\0E HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\0F HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\10 HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\11 HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\12 HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\13 HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\14 HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\15 HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\16 HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\17 HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\18 HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\19 HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\1A HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\1B HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\1C HKEY_CURRENT_USER\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\1D HKEY_LOCAL_MACHINE\Software\Cygnus Solutions HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\Cygwin HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\Cygwin\mounts v2 HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\Cygwin\mounts v2\/ (default) =3D `C:/cygwin' flags =3D 0x00000008 HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\Cygwin\mounts v2\/usr/bin (default) =3D `C:/cygwin/bin' flags =3D 0x00000008 HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\Cygwin\mounts v2\/usr/lib (default) =3D `C:/cygwin/lib' flags =3D 0x00000008 HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\Cygwin\Program Options HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL setup HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL setup\b15.0 HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\00 HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\01 HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\02 HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\03 HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\04 HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\05 HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\06 HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\07 HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\08 HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\09 HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\0A HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\0B HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\0C HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\0D HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\0E HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\0F HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\10 HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\11 HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\12 HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\13 HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\14 HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\15 HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\16 HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\17 HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\18 HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\19 HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\1A HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\1B HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\1C HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\CYGWIN.DLL = setup\b15.0\mounts\1D a: fd FAT 1Mb 100% CP UN =20 c: hd FAT32 7985Mb 33% CP UN WIN98 d: hd FAT32 7985Mb 16% CP UN USER e: hd FAT32 7985Mb 1% CP UN =20 f: hd FAT32 7985Mb 1% CP UN =20 g: fd N/A N/A =20 h: cd UDF 2876Mb 100% UN bmm2001pdvd i: cd CDFS 40Mb 100% UN Acu-Vol 87-2 C:\cygwin\bin /usr/bin system textmode C:\cygwin\lib /usr/lib system textmode C:\cygwin / system textmode c: /cygdrive/c user textmode,noumount d: /cygdrive/d user textmode,noumount e: /cygdrive/e user textmode,noumount f: /cygdrive/f user textmode,noumount h: /cygdrive/h user textmode,noumount i: /cygdrive/i user textmode,noumount Found: C:\cygwin\bin\bash.exe Found: C:\cygwin\bin\cat.exe Found: C:\cygwin\bin\cpp.exe Found: C:\cygwin\bin\find.exe Found: c:\WINDOWS\COMMAND\find.exe Warning: C:\cygwin\bin\find.exe hides c:\WINDOWS\COMMAND\find.exe Found: C:\cygwin\bin\gcc.exe Found: C:\cygwin\bin\gdb.exe Found: C:\cygwin\bin\ld.exe Found: C:\cygwin\bin\ls.exe Found: C:\cygwin\bin\make.exe Found: C:\cygwin\bin\sh.exe 56k 2000/12/03 C:\cygwin\bin\cygbz21.0.dll - os=3D4.0 img=3D1.0 = sys=3D4.0 "cygbz21.0.dll" v0.0 ts=3D2000/11/21 0:53 390k 2000/12/05 C:\cygwin\bin\cygtcl80.dll - os=3D4.0 img=3D1.0 = sys=3D4.0 "cygtcl80.dll" v0.0 ts=3D2000/11/26 2:39 5k 2000/12/05 C:\cygwin\bin\cygtclpip80.dll - os=3D4.0 img=3D1.0 = sys=3D4.0 10k 2000/12/05 C:\cygwin\bin\cygtclreg80.dll - os=3D4.0 img=3D1.0 = sys=3D4.0 "cygtclreg80.dll" v0.0 ts=3D2000/11/26 2:39 81k 2000/12/05 C:\cygwin\bin\cygitcl30.dll - os=3D4.0 img=3D1.0 = sys=3D4.0 "cygitcl30.dll" v0.0 ts=3D2000/11/26 2:43 35k 2000/12/05 C:\cygwin\bin\cygitk30.dll - os=3D4.0 img=3D1.0 = sys=3D4.0 "cygitk30.dll" v0.0 ts=3D2000/11/26 2:43 623k 2000/12/05 C:\cygwin\bin\cygtk80.dll - os=3D4.0 img=3D1.0 = sys=3D4.0 "cygtk80.dll" v0.0 ts=3D2000/11/26 2:43 18k 2000/10/23 C:\cygwin\bin\cyggdbm.dll - os=3D4.0 img=3D1.0 = sys=3D4.0 "cyggdbm.dll" v0.0 ts=3D2000/10/23 4:26 14k 2000/10/23 C:\cygwin\bin\cygintl.dll - os=3D4.0 img=3D1.0 = sys=3D4.0 "cygintl.dll" v0.0 ts=3D2000/10/23 21:02 45k 2000/10/22 C:\cygwin\bin\cygjbig1.dll - os=3D4.0 img=3D1.0 = sys=3D4.0 "cygjbig1.dll" v0.0 ts=3D2000/10/23 1:06 119k 2000/10/23 C:\cygwin\bin\cygjpeg6b.dll - os=3D4.0 img=3D1.0 = sys=3D4.0 "cygjpeg6b.dll" v0.0 ts=3D2000/10/23 2:58 163k 2001/05/06 C:\cygwin\bin\cygpng2.dll - os=3D4.0 img=3D1.0 = sys=3D4.0 "cygpng2.dll" v0.0 ts=3D2001/5/6 6:05 45k 2001/04/25 C:\cygwin\bin\cygform5.dll - os=3D4.0 img=3D1.0 = sys=3D4.0 "cygform5.dll" v0.0 ts=3D2001/4/25 7:28 26k 2001/04/25 C:\cygwin\bin\cygmenu5.dll - os=3D4.0 img=3D1.0 = sys=3D4.0 "cygmenu5.dll" v0.0 ts=3D2001/4/25 7:27 156k 2001/04/25 C:\cygwin\bin\cygncurses++5.dll - os=3D4.0 img=3D1.0 = sys=3D4.0 "cygncurses++5.dll" v0.0 ts=3D2001/4/25 7:29 226k 2001/04/25 C:\cygwin\bin\cygncurses5.dll - os=3D4.0 img=3D1.0 = sys=3D4.0 "cygncurses5.dll" v0.0 ts=3D2001/4/25 7:17 15k 2001/04/25 C:\cygwin\bin\cygpanel5.dll - os=3D4.0 img=3D1.0 = sys=3D4.0 "cygpanel5.dll" v0.0 ts=3D2001/4/25 7:27 17k 2001/01/07 C:\cygwin\bin\cyghistory4.dll - os=3D4.0 img=3D1.0 = sys=3D4.0 "cyghistory4.dll" v0.0 ts=3D2001/1/7 5:34 108k 2001/01/07 C:\cygwin\bin\cygreadline4.dll - os=3D4.0 img=3D1.0 = sys=3D4.0 "cygreadline4.dll" v0.0 ts=3D2001/1/7 5:34 243k 2000/10/23 C:\cygwin\bin\cygtiff3.dll - os=3D4.0 img=3D1.0 = sys=3D4.0 "cygtiff3.dll" v0.0 ts=3D2000/10/23 3:14 41k 2000/11/20 C:\cygwin\bin\cygXpm-noX4.dll - os=3D4.0 img=3D1.0 = sys=3D4.0 "cygXpm-noX4.dll" v0.0 ts=3D2000/11/20 3:41 45k 2000/11/20 C:\cygwin\bin\cygXpm-X4.dll - os=3D4.0 img=3D1.0 = sys=3D4.0 "cygXpm-X4.dll" v0.0 ts=3D2000/11/20 3:45 49k 2001/02/03 C:\cygwin\bin\cygz.dll - os=3D4.0 img=3D1.0 sys=3D4.0 "cygz.dll" v0.0 ts=3D2001/2/3 21:35 631k 2001/04/25 C:\cygwin\bin\cygwin1.dll - os=3D4.0 img=3D1.0 = sys=3D4.0 "cygwin1.dll" v0.0 ts=3D2001/4/25 2:01 Cygwin DLL version info: dll major: 1003 dll minor: 1 dll epoch: 19 dll bad signal mask: 19005 dll old termios: 5 dll malloc env: 28 api major: 0 api minor: 38 shared data: 3 dll identifier: cygwin1 mount registry: 2 cygnus registry name: Cygnus Solutions cygwin registry name: Cygwin program options name: Program Options cygwin mount registry name: mounts v2 cygdrive flags: cygdrive flags cygdrive prefix: cygdrive prefix cygdrive default prefix:=20 build date: Tue Apr 24 20:01:02 EDT 2001 shared id: cygwin1S3 Use -h to see help about each section ------=_NextPart_000_0009_01C10195.FE1C31A0 Content-Type: text/plain; charset=us-ascii -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ ------=_NextPart_000_0009_01C10195.FE1C31A0--