From nobody  Thu Feb 26 00:04:58 1998
Received: (from nobody@localhost)
          by hub.freebsd.org (8.8.8/8.8.8) id AAA11431;
          Thu, 26 Feb 1998 00:04:58 -0800 (PST)
          (envelope-from nobody)
Message-Id: <199802260804.AAA11431@hub.freebsd.org>
Date: Thu, 26 Feb 1998 00:04:58 -0800 (PST)
From: aryeh@rad-inet.com
To: freebsd-gnats-submit@freebsd.org
Subject: atof/strtod busted
X-Send-Pr-Version: www-1.0

>Number:         5856
>Category:       misc
>Synopsis:       atof/strtod busted
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    steve
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Feb 26 00:10:01 PST 1998
>Closed-Date:    Thu Feb 26 07:06:06 PST 1998
>Last-Modified:  Thu Feb 26 07:10:08 PST 1998
>Originator:     Aryeh Friedman
>Release:        2.2.5-RELASE (2/20/98)
>Organization:
Radical Internet
>Environment:
FreeBSD void.rad-inet.com 2.2.5-RELEASE FreeBSD 2.2.5-RELEASE #0: Sat May 18 21:05:23 GMT 1996     root@:/usr/src/sys/compile/B5  i386

>Description:
atof for any string either containing numbers, alpa, or alphanum always
returns a value of 1	
>How-To-Repeat:
main()
{
	duble foo;

	foo=atof("3.145");
	printf("%f",foo);
}
>Fix:

>Release-Note:
>Audit-Trail:

From: Zach Heilig <zach@gaffaneys.com>
To: aryeh@rad-inet.com, freebsd-gnats-submit@FreeBSD.ORG
Cc:  Subject: Re: misc/5856: atof/strtod busted
Date: Thu, 26 Feb 1998 07:36:56 -0600

 On Thu, Feb 26, 1998 at 12:04:58AM -0800, aryeh@rad-inet.com wrote:
 > >Description:
 > atof for any string either containing numbers, alpa, or alphanum always
 > returns a value of 1	
 > >How-To-Repeat:
 > main()
 > {
 > 	duble foo;
 > 
 > 	foo=atof("3.145");
 > 	printf("%f",foo);
 > }
 
 You need to include headers for the functions you call.  In this case, you need
 <stdio.h> for printf() and <stdlib.h> for atof.  Then your program works:
 
 #include <stdio.h>
 #include <stdlib.h>
 
 int
 main(void)
 {
   double foo;
 
   foo = atof("3.1415");
   printf("%f\n", foo);
 
   return 0;
 }
State-Changed-From-To: open->closed 
State-Changed-By: steve 
State-Changed-When: Thu Feb 26 07:06:06 PST 1998 
State-Changed-Why:  
Without #include <stdlib.h> the compiler assumes that atof 
returns an int, which will make you program not work.  Solution: 
include the following lines at the top of your program: 


#include <stdio.h> 
#include <stdlib.h> 
>Unformatted:
