Salome HOME
Small source code improvement V6_main_20110815 V6_main_20110817 V6_main_20110818 V6_main_20110822 V6_main_20110823 V6_main_20110824 V6_main_20110901 V6_main_20110902 V6_main_20110905 V6_main_20110906 V6_main_20110908 V6_main_20110909 before_mergefrom_V6_3_BR_08Aug11 mergefrom_V6_3_BR_08Aug11
authorvsr <vsr@opencascade.com>
Fri, 12 Aug 2011 06:38:28 +0000 (06:38 +0000)
committervsr <vsr@opencascade.com>
Fri, 12 Aug 2011 06:38:28 +0000 (06:38 +0000)
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;