VTK/VTK6/Migration/DoublePrecisionPi: Difference between revisions
(Created page with "VTK6 represents a major upgrade to VTK. The upgrade presents an opportunity to provide consistent representation and usage of Pi and TwoPi. This experiment uses the [http://en.w...") |
|||
Line 35: | Line 35: | ||
==Analyze== | ==Analyze== | ||
Sometime around vtk4.4, most floating point calculations were converted from single precision to double precision. Apparently at that time, the vtkMath::Pi() was not converted to double. Rather, vtkMath::DoublePi() was introduced. Also, throughout the toolkit, some developers chose to use explicit representations of Pi. These varied in precision. | |||
==Improve== | ==Improve== |
Revision as of 18:49, 14 May 2012
VTK6 represents a major upgrade to VTK. The upgrade presents an opportunity to provide consistent representation and usage of Pi and TwoPi.
This experiment uses the DMAIC methodology of the Six Sigma management process to "Define", "Measure", "Analyze", "Improve" and "Control" valgrind defects in VTK.
The basic methodology (from Wikipedia) consists of the following five steps:
- Define process goals that are consistent with customer demands and VTK's strategy.
- Measure key aspects of the current process and collect relevant data.
- Analyze the data to verify cause-and-effect relationships. Determine what the relationships are, and attempt to ensure that all factors have been considered.
- Improve or optimize the process.
- Control to ensure that any deviations from target are corrected before they result in defects. Set up pilot runs to establish software quality, move on to production, set up control mechanisms and continuously monitor the process.
Define
Provide a consistent use if Pi and TwoPi throughout the toolkit. Currently Pi is used in the following manner:
- vtkMath::Pi() returns a single precision representation of Pi.
- vtkMath::DoublePi() returns a double precision representation of Pi.
- Explict forms like 3.1415927
- 3.141593
- 3.1415926
- 3.141592653589
- 3.141592654
- 3.14159265358979
- 3.141592653589793
- 3.14159265358979323846
Similar uses exist for TwoPi, DoubleTwoPi and 6.28...
Measure
Pi usage was measured using the unix grep command on just .cxx files.
- vtkMath::Pi() - 64 files
- vtkMath::DoublePi() - 13 files
- Explicit Pi - 19 files
- vtkMath::TwoPi - 0 files
- vtkMath::DoubleTwoPi() - 4 files
- Explicit 2Pi - 5 files
Analyze
Sometime around vtk4.4, most floating point calculations were converted from single precision to double precision. Apparently at that time, the vtkMath::Pi() was not converted to double. Rather, vtkMath::DoublePi() was introduced. Also, throughout the toolkit, some developers chose to use explicit representations of Pi. These varied in precision.
Improve
Control
Gerrit reviewers should watch for the introduction of explicit representation of Pi and 2Pi