> > float f = fNAN, it ends up with 0x4EFF8000 instead. I tried various casts,
> > as well as #defines, to no avail. What is the trick?
>
> *((Int32 *)&f) = fNAN;
> *((Int64 *)&d) = dNAN;
..
> > if ( f == fNAN )
needs to be:
if (*((Int32 *)&f) == fNAN)
as well. you could also use a union, as philip sheard mentioned; but
it wont be as elegant. what i would do, is write macros.
#define SET_NAN(f) *((Int32 *)&(f)) = fNAN
#define IS_NAN(f) (*((Int32 *)&(f)) == fNAN)
this assumes that f is a variable, not a constant - as & will get ugly :P
then you simply call as:
SET_NAN(f);
if (IS_NAN(f))
{
}
you can play with it to get it looking more elegant. idea remains.
--
// Aaron Ardiri
--
For information on using the ACCESS Developer Forums, or to unsubscribe, please
see http://www.access-company.com/developers/forums/