Path: utzoo!attcan!uunet!husc6!bloom-beacon!tut.cis.ohio-state.edu!accelerator.eng.ohio-state.edu!kaa.eng.ohio-state.edu!rob From: rob@kaa.eng.ohio-state.edu (Rob Carriere) Newsgroups: comp.lang.c Subject: Re: Problem with Turbo C and floating point Message-ID: <477@accelerator.eng.ohio-state.edu> Date: 16 Aug 88 19:42:42 GMT References: <1817@akgua.ATT.COM> Sender: news@accelerator.eng.ohio-state.edu Reply-To: rob@kaa.eng.ohio-state.edu (Rob Carriere) Organization: Ohio State Univ, College of Engineering Lines: 16 In article <1817@akgua.ATT.COM> brb@akgua.ATT.COM (Brian R. Bainter) writes: > [...] >If the number in the string is for example 9999999.99 it ends up in >the float as 10000000.00000 and a number entered as 1111111.11 ends >up in the float as 1111111.12500. > [...] Doing a quick digit count, it looks as if you are up against the precision limit of float. If this is true (check your Turbo docs for the float format TC uses, I don't know), then the solution is simply to use doubles, and change the sscanf conversion character correspondingly. You will eventually have to do this anyway, as ANSI seems to have decided, in its' infinite wisdom, that reading floats (as opposed to doubles) is a no-no. Rob Carriere