[vtk-developers] isnan
John Platt
jcplatt at dsl.pipex.com
Sun Jan 14 13:07:34 EST 2007
David,
You're probably right about MSVC 6 but for those of us who are stuck
with it, the following may be useful.
John.
static int IsNaN(const double x)
{
unsigned int e_mask, f_mask;
double as_double = x;
unsigned int *as_int;
vtkByteSwap::Swap8BE(&as_double);
as_int = (unsigned int *)&as_double;
vtkByteSwap::Swap4BE(as_int);
e_mask = 0x7ff0;
e_mask <<= 16;
if ((*as_int & e_mask) != e_mask)
{
return 0;
}
f_mask = 1;
f_mask <<= 20;
f_mask--;
return (*as_int & f_mask) != 0;
}
-----Original Message-----
From: vtk-developers-bounces+jcplatt=dsl.pipex.com at vtk.org
[mailto:vtk-developers-bounces+jcplatt=dsl.pipex.com at vtk.org] On Behalf
Of Thompson, David C
Sent: 14 January 2007 00:10
To: Michael Halle; vtk-developers at vtk.org
Subject: RE: [vtk-developers] isnan
> In the mean time, how about the question of where to put
> the actual isnan function in VTK, hopefully in a way that
> introduces as little overhead as possible? Is vtkstd::isnan()
> the right place (since that's analogous to std::isnan() )?
Note that vtkMath already has static member functions
Inf(), NegInf(), and Nan() that return constants. If isnan
is placed in vtkstd, then these functions should also move
there. I would prefer vtkMath::IsNan() though. Also, I'm under
the impression that some of the compilers that Kitware wishes
to support (*cough*MSVC 6*cough*) don't have isnan() at all -- but
I could easily be wrong about that as I am not a Windows person.
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20070114/f9b92b8d/attachment.html>
More information about the vtk-developers
mailing list