Implicit decimal points in floating-point reads

Doug Gwyn gwyn at smoke.brl.mil
Sat May 25 07:02:12 AEST 1991


In article <5889 at goanna.cs.rmit.oz.au> ok at 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.



More information about the Comp.lang.c mailing list