Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • VTK VTK
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 740
    • Issues 740
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 199
    • Merge requests 199
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • VTK
  • VTKVTK
  • Issues
  • #1158
Closed
Open
Created Sep 12, 2004 by Kitware Robot@kwrobotOwner

vtkFloorFuncMacro produces incorrect results on i386

This issue was created automatically from an original Mantis Issue. Further discussion may take place here.


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.

Assignee
Assign to
Time tracking