delorie.com/archives/browse.cgi | search |
X-Originating-IP: | [200.42.6.189] |
From: | "Norberto Alfredo Bensa" <ceo AT nbensacomputers DOT com> |
To: | <djgpp AT delorie DOT com> |
References: | <3ADDDAE3 DOT 29499 DOT 112013C AT localhost> |
Subject: | Re: Atof |
Date: | Wed, 18 Apr 2001 14:05:47 -0300 |
Organization: | nBens@ Computers |
X-Priority: | 3 |
X-MSMail-Priority: | Normal |
X-Mailer: | Microsoft Outlook Express 5.50.4522.1200 |
X-MimeOLE: | Produced By Microsoft MimeOLE V5.50.4522.1200 |
Message-ID: | <OE282LTrpwACkWHZqYW00001f8d@hotmail.com> |
X-OriginalArrivalTime: | 18 Apr 2001 17:08:39.0700 (UTC) FILETIME=[369FD540:01C0C82A] |
Reply-To: | djgpp AT delorie DOT com |
> Hi, > i have this problem with atof(); > > char *buf = "-21.345\0"; while not a bug, you can write "-21.345"... > float f = 0; > > f = atof ( buf ); > printf("%f",f); > > , then i have this "-21.344999". > What i must to do for it will be OK. It's ok... it has to do with the way floating point numbers are store on the computer's memory... use "%.3f" in thise case and it'll print -21.345 Best reagards, Norberto > > Thank you >
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |