From owner-freebsd-questions Sun Oct 8 21:51:14 2000 Delivered-To: freebsd-questions@freebsd.org Received: from srcso.globis.ru (globis.ru [212.248.80.7]) by hub.freebsd.org (Postfix) with ESMTP id 6EAF137B66C for ; Sun, 8 Oct 2000 21:51:08 -0700 (PDT) Received: from raduga.dyndns.org (raduga.sochi.net [212.248.82.76]) by srcso.globis.ru (8.9.3/8.9.3) with ESMTP id JAA19864 for ; Mon, 9 Oct 2000 09:11:03 +0400 (MSD) (envelope-from igor@raduga.dyndns.org) Received: (from igor@localhost) by raduga.dyndns.org (8.10.0/8.10.0) id e994lSZ04740 for freebsd-questions@FreeBSD.ORG; Mon, 9 Oct 2000 08:47:28 +0400 Date: Mon, 9 Oct 2000 08:47:28 +0400 From: Igor Roboul To: freebsd-questions@FreeBSD.ORG Subject: Re: Am I crazy ot libc is not working? (atof()) Message-ID: <20001009084728.C1318@linux.rainbow> Reply-To: igorr@crosswinds.net Mail-Followup-To: freebsd-questions@FreeBSD.ORG References: <39DB3EBF.CC697AE5@chat.ru> <20001004162941.A24879@student.uu.se> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0pre4i In-Reply-To: <20001004162941.A24879@student.uu.se>; from ertr1013@student.uu.se on Wed, Oct 04, 2000 at 04:29:41PM +0200 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Wed, Oct 04, 2000 at 04:29:41PM +0200, Erik Trulsson wrote: > You did remember to #include 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