[vtk-developers] isnan

Michael Halle mhalle at bwh.harvard.edu
Sat Jan 13 23:18:53 EST 2007


Thompson, David C wrote:
>  > 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. 

Honestly, I missed those because I was looking for the test.  However, I think you really need the isnan() test too.  As Bill pointed out, math operations on NaN can be slow because of potential special handling in the floating point units.  The isnan() test can avoid that problem by doing the test carefully (bitwise?) rather than as a generic float or double compare.

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.

I believe ITK supports isnan(), but I didn't really follow the discussing thread about it except to get it running on the Mac.  Is there a difference in ITK and VTK supported compilers?

Thanks a lot.

--Mike



More information about the vtk-developers mailing list