This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Amendment to post: atof() bug in b17.1 & b18?


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@cygnus.com" with one line of text: "help".
>
>

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]