Salome HOME
Small source code improvement
[modules/visu.git] / src / PIPELINE / VISU_Extractor.cxx
index 34063cd2498b215051d52942a05adf9975283db5..20b64e1e79aa60df3bfa3d5533fbda7ccc86cfea 100644 (file)
 #include <vtkInformation.h>
 #include <vtkInformationVector.h>
 
-#define USE_SPRINTF 1
+// Algorithm to cut values (see CutValue())
+// Use sprintf function
+#define USE_SPRINTF
+// Use new algorithm (works only when USE_SPRINTF is disabled)
+#define USE_NEW_ALGORITHM
 
 //----------------------------------------------------------------------------
 vtkStandardNewMacro(VISU_Extractor);
@@ -107,15 +111,13 @@ vtkFloatingPointType CutValue (vtkFloatingPointType theValue, int theDecimals)
 {
   vtkFloatingPointType v = theValue;
 
-#ifdef USE_SPRINTF
+#if defined(USE_SPRINTF)
   char aFormat[16];
   sprintf(aFormat, "%%.%dg", theDecimals);
   char aStr [256];
   sprintf(aStr, aFormat, theValue);
   v = atof(aStr);
-#else
-
-#ifndef USE_OLD_ALGORITHM
+#elif defined(USE_NEW_ALGORITHM)
   //
   // VSR 19/10/2009: new algorithm does not use long long type
   //
@@ -152,8 +154,6 @@ vtkFloatingPointType CutValue (vtkFloatingPointType theValue, int theDecimals)
   aDegree = pow(10, aDegree);
   v = ((vtkFloatingPointType)((long long)(v * aDegree))) / aDegree;
   //printf("$$$ 2 v = %.20g , aDegree = %lld \n", v, (long long)aDegree);
-#endif
-
 #endif
 
   return v;