[vtk-developers] Adding IsNan() to vtkMath

Moreland, Kenneth kmorel at sandia.gov
Mon Jul 20 18:19:57 EDT 2009


Brad,

The source code you sent has as one of its cases a check of the bits of an IEEE-754 number.  I see that vtkMath already has a Nan function that returns an IEEE NaN.  If VTK is only supporting IEEE-754 in the first place, is there any problem with just performing the bit check?

-Ken


On 7/20/09 3:40 PM, "Brad King" <brad.king at kitware.com> wrote:

Moreland, Kenneth wrote:
> int vtkMath::IsNan(double x)
> {
>   return isnan(x);
> }
>
> Does anyone know any portability issues with this?

Getting this to work everywhere (not just compile) is somewhat
involved.  The vxl folks have code here:

http://vxl.svn.sourceforge.net/viewvc/vxl/trunk/core/vnl/vnl_math.cxx?revision=24028&view=markup

Note that there should be overloads for float, double, and
perhaps long double.

-Brad




   ****      Kenneth Moreland
    ***      Sandia National Laboratories
***********
*** *** ***  email: kmorel at sandia.gov
**  ***  **  phone: (505) 844-8919
    ***      web:   http://www.cs.unm.edu/~kmorel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20090720/630131bc/attachment.html>


More information about the vtk-developers mailing list