Bug in atof?

Bug in atof?

Post by Tsung-lung » Mon, 30 Aug 1993 06:08:39



Hello,

If I am doing right in the following program, I have found a bug in "atof".

#include        <math.h>
#include        <stdio.h>

main()
{
    static char         st[80] = {'1', 'E', '+', '4'};
    float       x;

    x = atof( st );
    printf( "%s %f\n", st, x );

Quote:}

Execution results:
1E+4 1.000000

If you think I have done anything incorrect, please e-mail me at

Thank you.

Tsung

 
 
 

Bug in atof?

Post by Rich Mulv » Mon, 30 Aug 1993 07:02:10



> Hello,

> If I am doing right in the following program, I have found a bug in "atof".

> #include        <math.h>
> #include        <stdio.h>

> main()
> {
>     static char         st[80] = {'1', 'E', '+', '4'};
>     float       x;

>     x = atof( st );
>     printf( "%s %f\n", st, x );
> }

> Execution results:
> 1E+4 1.000000

--
   You need to include stdlib.h so that you get the correct prototype for
atof.  As it is now, atof is implicitly defined to return an int.

- Rich

--
Rich Mulvey            Amateur Radio: N2VDS            787 Elmwood Terrace


 
 
 

1. atof() bug in Linux gcc

--

Hewlett-Packard Corp.
Microwave Instruments Division R&D

=============================================================================
The Three Laws of Thermodynamics:

The First Law:  You can't get anything without working for it.
The Second Law: The most you can accomplish by working is to break
                even.
The Third Law:  You can only break even at absolute zero.
=============================================================================

2. bootp problem : bad addr len from from Ethernet

3. libc/atof question/bug

4. is there any way to upgrade to R.H5.1 from 5.0 without reinstalling all stuff that i have on it now ??

5. atof bug in gcc v2.11c?

6. Right border?

7. Problems with atof when using X11

8. Smartmedia PCMCIA adapter

9. atof converting 22.06 to 22.059999

10. atof problems.

11. SIGFPE with atof()

12. atof() in SCO UNIX DEV

13. atof broken?