[vtk-developers] Bug report: vtkFloorFuncMacro

Andy Cedilnik andy.cedilnik at kitware.com
Mon Sep 13 07:41:58 EDT 2004


Hi Ovidiu,

What do you mean by "doesn't seem to offer the ability to report a bug"?
Several people are reporting bugs without any problem. Please use
"Create a new Account" to create account for you, then login and use
"Add a new Bug" to report a bug.

Thank you.

			Andy Cedilnik
			Kitware Inc.

On Sun, 2004-09-12 at 20:19, Ovidiu Toader wrote:
> The bug report URL,  http://public.kitware.com/Bug/, doesn't seem to offer the 
> ability to report a bug so I have no choice but to broadcast this message on 
> the list. I apologize in advance to anybody that finds this inappropriate but 
> I believe that this bug is too serious  to be ignored.
> 
> In file Rendering/vtkVolumeRayCastMapper.h there is a function named 
> vtkFloorFuncMacro. This function  does not produce correct results for all 
> inputs on a platform that does not use the "quick-and-dirty" solution:
> 
> inline int vtkFloorFuncMacro(double x)
> {
> #if defined i386 || defined _M_IX86
>   double tempval;
>   // use 52-bit precision of IEEE double to round (x - 0.25) to
>   // the nearest multiple of 0.5, according to prevailing rounding
>   // mode which is IEEE round-to-nearest,even
>   tempval = (x - 0.25) + 3377699720527872.0; // (2**51)*1.5
>   // extract mantissa, use shift to divide by 2 and hence get rid
>   // of the bit that gets messed up because the FPU uses
>   // round-to-nearest,even mode instead of round-to-nearest,+infinity
>   return ((int*)&tempval)[0] >> 1;
> #else
>   // quick-and-dirty, assumes x >= 0
>   return (int)(x);
> #endif
> }
> 
> As an example take vtkFloorFuncMacro(0.99989) which should return 0. Instead 
> it returns 1, which is wrong. Because of failures like this, volume rendering 
> that uses vtkVolumeRayCastMapper can produce random crashes. After I replaced 
> the body of this function with the standard "floor(x)" all the random crashes 
> I experienced before are gone.  





More information about the vtk-developers mailing list