Article View: aus.stats.s
Article #16144Re: NaNs in S
From: Gary Houston
Date: Fri, 17 Jan 1992 06:07
Date: Fri, 17 Jan 1992 06:07
37 lines
1847 bytes
1847 bytes
On further reflection I have realized that my missing value
problem was not well specified. Assuming the use of the
IEEE 754-1985 standard, it is relatively easy to
make a missing value in C and pass it back to S using the
NAOK=T option: any of NaN values in C (i.e., any number starting
with 0x7FF) will be converted by S to NA. Therefore, the
1/a - 1/a trick works.
However, I would also like to be able to pass missing values to
S using the call_S routine. This doesn't have a NAOK option, so it is
necessary to create a missing value within C with the one
true value that S uses internally for NA, i.e.,
7FF0000100000000
So the question is now: what is an elegant way of assigning
7FF0000100000000 to a double precision number within C? Ideally
I would like to define a macro MISSING, which could be used
like NA in S. Maybe S already has something like this internally.
I don't claim to be a C expert; the best I can do at present is:
double arguments[1];
char *memloc;
int c;
memloc = (char *) &arguments[0];
for (c = 0; c < 8; c++)
*(memloc + c) = 0;
*memloc = 0x7f;
*(memloc + 1) = 0xf0;
*(memloc + 3) = 1;
Gary Houston
Department of Statistics
Wellington, NZ
D
Technical Details
Message-ID:
<9201170540.AA02496@wright.stats.govt.nz>Path:
arc1-ca.pugleaf.net!sparky!uunet!math.fu-berlin.de!NewsServ!reseq!munnari.oz.au!uniwa!dmsperth!dmssyd.syd.dms.CSIRO.AU!newsShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fa931,7285bbe149b40edc X-Google-Attributes: gidfa931,public X-Google-ArrivalTime: 1992-01-18 16:36:58 PST Path: arc1-ca.pugleaf.net!sparky!uunet!math.fu-berlin.de!NewsServ!reseq!munnari.oz.au!uniwa!dmsperth!dmssyd.syd.dms.CSIRO.AU!news From: ghouston@stats.govt.nz (Gary Houston) Newsgroups: aus.stats.s Subject: Re: NaNs in S Message-ID: <9201170540.AA02496@wright.stats.govt.nz> Date: 17 Jan 92 06:07:53 GMT Sender: daemon@syd.dms.CSIRO.AU Organization: CSIRO Div. Maths & Stats, CSIRO Div. Applied Physics Lines: 36 X-Gateway: dmssyd.syd.dms.CSIRO.AU