Date: Thu, 26 Feb 1998 13:49:17 -0600 (CST) From: Dave Bodenstab <imdave@mcs.net> To: freebsd-bugs@FreeBSD.ORG Cc: aryeh@rad-inet.com Subject: Re: misc/5856: atof/strtod busted Message-ID: <199802261949.NAA24005@base486.home.org>
index | next in thread | raw e-mail
> From: aryeh@rad-inet.com
>
> >Number: 5856
> >Category: misc
> >Synopsis: atof/strtod busted
> >Confidential: no
> >Severity: serious
> >Priority: medium
> >Responsible: freebsd-bugs
> >State: open
> >Quarter:
> >Keywords:
> >Date-Required:
> >Class: sw-bug
> >Submitter-Id: current-users
> >Arrival-Date: Thu Feb 26 00:10:01 PST 1998
> >Last-Modified:
> >Originator: Aryeh Friedman
> >Organization:
> Radical Internet
> >Release: 2.2.5-RELASE (2/20/98)
> >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:
If you don't declare atof() to return ``double'', or include stdlib.h,
the compiler assumes that atof() returns ``int''. Since this is
incorrect, you get incorrect results.
Dave Bodenstab
imdave@mcs.net
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199802261949.NAA24005>
