C99 provides nan(). I see that this is available on Linux (well Debian
Sarge and Fedora Core 3, at least)
Solaris provides quiet_nan() and signaling_nan().
Perhaps the best approach would be to have a single PDL routine
returning NaN which is tuned for platforms with explicit support, with a
fall back for those without any special NaN support.
Diab
On Sun, 2006-07-02 at 16:39 -0400, Douglas Burke wrote:
>
> On Sun, 2 Jul 2006, Douglas Burke wrote:
>
> >
> > I think afot("NaN") works on many unix-ey systems but I don't know about
>
> Or atof() even...
>
> > Windows. If you dig around in the bad-value handling code in either
> > Basic/bad.pd or somewhere in Core/ then you can see a nasty way I did it
> > using structs, but I worry about the portability of this construct.
> >
> > Doug
> >
> > On Fri, 30 Jun 2006, Bill Coffman wrote:
> >
> > > Is there a way to generate NaN values that works on all platforms? I mean
> > > ones that support ieee floats, of course.
> > >
> > > GCC 4 and ICC 9 (intel) don't complain a bit for:
> > >
> > > ((double)0.0/(double)0.0)
> > >
> > > and I noticed Sisyphus coded this for microsoft VC (except using an
> > > intermediate var). The nan("NaN") is not universally supported, but it
> > > seems that 0/0.0 is pretty clearly a NaN.
> > >
> > > I noticed someone else used sqrt(-1) and mentioned specifically maximizing
> > > cross-compatibility. This seems a little wasteful to me, as a call to
> > > sqrt
> > > could be avoided if one is building a matrix full of NaN's.
> > >
> > > Bill
> > >
> >
> > _______________________________________________
> > PDL-porters mailing list
> > PDL-porters@xxxxxxxxxxxxxxx
> > http://mailman.jach.hawaii.edu/mailman/listinfo/pdl-porters
> >
>
> _______________________________________________
> PDL-porters mailing list
> PDL-porters@xxxxxxxxxxxxxxx
> http://mailman.jach.hawaii.edu/mailman/listinfo/pdl-porters
|