Date: Wed, 4 Oct 2000 16:29:41 +0200 From: Erik Trulsson <ertr1013@student.uu.se> To: jadream <jadream@chat.ru> Cc: freebsd-questions@freebsd.org Subject: Re: Am I crazy ot libc is not working? (atof()) Message-ID: <20001004162941.A24879@student.uu.se> In-Reply-To: <39DB3EBF.CC697AE5@chat.ru>; from jadream@chat.ru on Wed, Oct 04, 2000 at 06:29:19PM %2B0400 References: <39DB3EBF.CC697AE5@chat.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Oct 04, 2000 at 06:29:19PM +0400, jadream wrote: > Hi! > > I'm at the point of boiling after 10 hours trying to understand why > under FreeBSD 3.2 at x86 generic machine in C-file compiled with default > gcc without any specific clues standard lib function atof() is > malfunctioning. > > double res; > > res = atof("266738911.0"); > > res can be zero or someting less then zero or some "magic" value like > 10011000.000000. > > Just can't get what's wrong? > can't believe in such a stupid bug in libc. Maybe something more > complicated? > > Any ideas are welcome. 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. > > Don't blame me if it's an obvious thing - may be I really need some > medicine :0) > > Alex Komratov > > > with "unsubscribe freebsd-questions" in the body of the message -- <Insert your favourite quote here.> Erik Trulsson ertr1013@student.uu.se 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?20001004162941.A24879>