Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!bellcore!rutgers!cmcl2!adm!smoke!gwyn From: gwyn@smoke.brl.mil (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: Implicit decimal points in floating-point reads Keywords: scanf,floating point,decimal formats Message-ID: <16256@smoke.brl.mil> Date: 24 May 91 21:02:12 GMT References: <5366@dftsrv.gsfc.nasa.gov> <1991May21.200003.13471@wpi.WPI.EDU> <5889@goanna.cs.rmit.oz.au> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 16 In article <5889@goanna.cs.rmit.oz.au> ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) writes: >> x /= 1000.; /* simple, to the point, no fancy fix routines needed */ >Simple, to the point, and WRONG. The thing about the Fortran format which >the original poster wanted to emulate is that the decimal point is placed >implicitly where the format specification says *UNLESS* there is an >explicit decimal point in the input field. Note that in any given instance either (a) the whole file does have decimal points in the field, which can be determined from inspecting just ONE field ONE time, (b) the whole file does not have decimal points in the field, ditto, or (c) the file has a mixture of records with some having the decimal point and some not having it. Case (c) is the "accident waiting to happen" situation, and would almost certainly correspond to manual creation of the data. Cases (a) and (b) are almost certainly what one would see if the data were the output of another program or instrumentation system.