FLOATING NULL?

Wild Rider robertsw at ...!asuvax!gtephx
Wed May 29 06:28:14 AEST 1991


	In article <1991May28.153655.24199 at zoo.toronto.edu>
	henry at zoo.toronto.edu (Henry Spencer) writes:
>In article <13223 at uhccux.uhcc.Hawaii.Edu> karl at wiliki.UUCP (Karl Ihrig) writes:
	[ ... description of reading data from a spreadsheet file ... ]
>>...blank spots in my real world data.  I am totally baffled.  How do I
>>mark the float element of the array as null, blank, or not
>>available?
>
>There is no portable way except allocating a separate flag for each of
>your float values.  C does not guarantee the existence of any "blank" value
>in floating point, and indeed a good many machines have no such special
>value.  If you are willing to constrain your code to run on machines using
>IEEE floating point, you could use a NaN value... but there is no standard
>way of generating such a value or testing for it.

	although henry did directly answer karl's question, perhaps karl
	could do better by reevaluating what he's trying to do, i.e., is the
	chosen data structure appropriate for a spreadsheet?  since
	spreadsheets usually resemble a sparse matrix, i would rather choose
	something like:

		typedef struct row {
			int		rowNum;
			struct col *	colPtr;
		} Row;

		typedef struct col {
			int		colNum;
			float		cellValue;
			struct col *	nextCol;
		} Col;
			...
		Row *		masterPtr = NULL;
			...

>-- 
>"We're thinking about upgrading from    | Henry Spencer @ U of Toronto Zoology
>SunOS 4.1.1 to SunOS 3.5."              |  henry at zoo.toronto.edu  utzoo!henry
^^^^^^^^^^^^^^^^^^^^^^^^^^ is that pronounced "SunToast" ? :-)

	cheers,
	wr (wild rider)
-- 
Wallace Roberts, AG (formerly GTE) Communication Systems, Phoenix, AZ
UUCP: ...!{ncar!noao!asuvax | uunet!zardoz!hrc | att}!gtephx!robertsw
Internet: gtephx!robertsw at asuvax.eas.asu.edu    Bike: '82 GS1100L Suz
voice: (602)581-4555    fax: (602)582-7624      Cage: '89 Mustang  GT



More information about the Comp.lang.c mailing list