delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/06/14/19:58:56

From: mbenz19 AT idt DOT net ("Michael A. Benzinger")
Subject: Re: Amendment to post: atof() bug in b17.1 & b18?
14 Jun 1997 19:58:56 -0700 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <3.0.1.32.19970614190446.00916d50.cygnus.gnu-win32@mail.idt.net>
Mime-Version: 1.0
X-Sender: mbenz19 AT mail DOT idt DOT net
X-Mailer: Windows Eudora Pro Version 3.0.1 (32)
Original-To: e DOT dennis AT pemail DOT net, gnu-win32 mailing list <gnu-win32 AT cygnus DOT com>
In-Reply-To: <33A11FF7.1408CC00@pemail.net>
Original-Sender: owner-gnu-win32 AT cygnus DOT com

Ewen,

You need to #include stdlib.h at the top
of your program.  I got the same results
compiling your program as listed below.
When I added stdlib.h, the results were
as expected.  I am assuming here that
the atof routine is not be compiled and
called properly.

Mike Benzinger

At 11:24 AM 6/13/97 +0100, E. Dennis wrote:
>Hi.  Yes, more info.  Sorry.
>
>Example code follows:
>
>main()
>{
> float tst1, tst2, tst3, tst4, tst5;
> char ctst1[] = "0.5",
>      ctst2[] = "0.0",
>      ctst3[] = "60.00",
>      ctst4[] = "60.50",
>      ctst5[] = "1.011";
>
>
> tst1 = atof(ctst1);
> tst2 = atof(ctst2);
> tst3 = atof(ctst3);
> tst4 = atof(ctst4);
> tst5 = atof(ctst5);
>
> printf("%s = %f\n", ctst1, tst1);
> printf("%s = %f\n", ctst2, tst2);
> printf("%s = %f\n", ctst3, tst3);
> printf("%s = %f\n", ctst4, tst4);
> printf("%s = %f\n", ctst5, tst5);
>
>return 1;
>}
>
>Output from my beta-18-compiled binary:
>
>0.5 = 1.000000
>0.0 = -49.000000
>60.00 = 60.000000
>60.50 = 1.000000
>1.011 = 3.000000
>
>Help?
>
>Ewan Dennis,
>Integrated Media Services,
>Glasgow.
>-
>For help on using this list (especially unsubscribing), send a message to
>"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
>
>

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


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