From owner-freebsd-questions Wed Oct 4 7:29:55 2000 Delivered-To: freebsd-questions@freebsd.org Received: from hamberg.it.uu.se (hamberg.it.uu.se [130.238.9.198]) by hub.freebsd.org (Postfix) with ESMTP id 7E58537B502 for ; Wed, 4 Oct 2000 07:29:50 -0700 (PDT) Received: (from ertr1013@localhost) by hamberg.it.uu.se (8.8.5/8.8.5) id QAA01830; Wed, 4 Oct 2000 16:29:41 +0200 (MET DST) Date: Wed, 4 Oct 2000 16:29:41 +0200 From: Erik Trulsson To: jadream Cc: freebsd-questions@freebsd.org Subject: Re: Am I crazy ot libc is not working? (atof()) Message-ID: <20001004162941.A24879@student.uu.se> References: <39DB3EBF.CC697AE5@chat.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <39DB3EBF.CC697AE5@chat.ru>; from jadream@chat.ru on Wed, Oct 04, 2000 at 06:29:19PM +0400 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 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 -- Erik Trulsson ertr1013@student.uu.se To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message