]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Safer rounding
authormfloris <mfloris@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 29 Nov 2010 18:19:42 +0000 (18:19 +0000)
committermfloris <mfloris@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 29 Nov 2010 18:19:42 +0000 (18:19 +0000)
PWG2/SPECTRA/Fit/AliLatexTable.cxx

index 78c0fda4ea9dc944c1083c0e160292e30608ab03..71216c3bba5f48b74db93dce9673d8a44be3420f 100644 (file)
@@ -119,7 +119,7 @@ void AliLatexTable::SetNextCol(Double_t val, Int_t scientificNotation, Bool_t ro
     } else {
       char format[100];
       sprintf(format, " $%%%d.%df $", -scientificNotation,-scientificNotation);    
-      sprintf(col, format , val);
+      sprintf(col, format , TMath::Nint(val*TMath::Power(10,-scientificNotation))/TMath::Power(10,-scientificNotation));
       SetNextCol(col);
     } 
   }else {
@@ -170,7 +170,7 @@ void AliLatexTable::SetNextCol(Double_t val, Double_t err, Int_t scientificNotat
     } else  {
       char format[100];
       sprintf(format, " $%%%d.%df \\pm %%%d.%df $", -scientificNotation,-scientificNotation,-scientificNotation,-scientificNotation);    
-      sprintf(col, format , val, err);
+      sprintf(col, format , TMath::Nint(val*TMath::Power(10,-scientificNotation))/TMath::Power(10,-scientificNotation), TMath::Nint(err*TMath::Power(10,-scientificNotation))/TMath::Power(10,-scientificNotation));
       SetNextCol(col);
     }
   }
@@ -234,7 +234,7 @@ void AliLatexTable::SetNextCol(Double_t val, Double_t err, Double_t errSyst, Int
     } else  {
       char format[100];
       sprintf(format, " $%%%d.%df \\pm %%%d.%df \\pm %%%d.%df $", -scientificNotation,-scientificNotation,-scientificNotation,-scientificNotation, -scientificNotation,-scientificNotation);    
-      sprintf(col, format , val, err);
+      sprintf(col, format ,TMath::Nint(val*TMath::Power(10,-scientificNotation))/TMath::Power(10,-scientificNotation), TMath::Nint(err*TMath::Power(10,-scientificNotation))/TMath::Power(10,-scientificNotation), TMath::Nint(errSyst*TMath::Power(10,-scientificNotation))/TMath::Power(10,-scientificNotation));
       SetNextCol(col);
     } 
   }