Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!asuvax!mcdphx!hrc!gtephx!robertsw From: robertsw@...!asuvax!gtephx (Wild Rider) Newsgroups: comp.lang.c Subject: Re: FLOATING NULL? Message-ID: <1991May28.202814.1095@...!asuvax!gtephx> Date: 28 May 91 20:28:14 GMT References: <13223@uhccux.uhcc.Hawaii.Edu> <1991May28.153655.24199@zoo.toronto.edu> Reply-To: robertsw@gtephx.UUCP (Wild Rider) Organization: AG (formerly GTE) Comm. Sys., Phx, AZ Lines: 48 In article <1991May28.153655.24199@zoo.toronto.edu> henry@zoo.toronto.edu (Henry Spencer) writes: >In article <13223@uhccux.uhcc.Hawaii.Edu> karl@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@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@asuvax.eas.asu.edu Bike: '82 GS1100L Suz voice: (602)581-4555 fax: (602)582-7624 Cage: '89 Mustang GT