[Wayne]
Quote:
> >> The most portable way of doing this would be to make all your array
> >> elements structures:
> >> struct could_be_inf {
> >> double val;
> >> char inf_flag;
> >> }
[David]
Quote:
> >Ugh! You lose at least one byte per array element, and on most UNIX
> >platforms, probably 8 bytes because of padding.
[Wayne]
Quote:
> Shouldn't that be 4 bytes padding?
Nope, 8. Sparc 10's, for example, like to have doubles aligned on 8-byte
boundaries.
Quote:
> In a world of megabyte RAM and virtual memory the extra storage requirements
> might not make a difference. Moreover, the original poster did not indicate
> that he had a _huge_ array.
Maybe, maybe not. I did some array manipulation, and it's amazing how
quickly arrays eat up memory, even for average-size problems. Example:
I was curve-fitting 256 basis functions to 15000 datapoints, with 4
independent variables. That's a small problem in my line, but the
matrices were huge! I had one matrix that was 50MB alone.
Also, the "world of megabyte RAM" etc. attitude is what's responsible
for a Sparc 10 having the same perceived response time as my trusty
TRS-80 Color Computer from 1980. :-)
Quote:
> Very good. However, I still maintain that my method is the most portable.
Mine is equally portable. It's strictly ANSI C, so I don't know
what you mean by "most portable."
--
David F. Skoll
<a HREF="http://www.doe.carleton.ca/students/skoll/">
Click here for my home page</a> "Query two pi" on typewriter.