Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Oct 2000 08:47:28 +0400
From:      Igor Roboul <igor@raduga.dyndns.org>
To:        freebsd-questions@FreeBSD.ORG
Subject:   Re: Am I crazy ot libc is not working? (atof())
Message-ID:  <20001009084728.C1318@linux.rainbow>
In-Reply-To: <20001004162941.A24879@student.uu.se>; from ertr1013@student.uu.se on Wed, Oct 04, 2000 at 04:29:41PM %2B0200
References:  <39DB3EBF.CC697AE5@chat.ru> <20001004162941.A24879@student.uu.se>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Oct 04, 2000 at 04:29:41PM +0200, Erik Trulsson wrote:
> You did remember to #include <stdlib.h> to get the prototype for atof() ?
> Because if you didn't include that file the compiler will believe that atof
> returns an int and misinterpret the return value, which could well result
> in such behaviour as you describe.
Compiler (at least C compiler) Does not do typecasting. And if atof() returns
float, then printf("%f",atof(d)) will show it as float. Typecasting is done 
on runtime by printf(), which does not know anything about atof().
And as I (and others) show before, his program works as expected 
(shows float value).

-- 
Igor Roboul, Unix System Administrator & Programmer @ sanatorium "Raduga", 
Sochi, Russia
http://www.brainbench.com/transcript.jsp?pid=304744


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001009084728.C1318>