Skip to content
Snippets Groups Projects
Commit bf16e631 authored by Administrator's avatar Administrator Committed by Volker Friese
Browse files

Fix a precision problem

When comapring real numbers for equality one shouldn't compare the difference
of both values with zero. Due to rounding effects the result can be slightly
differnt from zero. If the difference of the values is smaller than a a small
value ( e.g. 0.00001 ) both values are equal.
parent 09ffe771
No related branches found
No related tags found
1 merge request!1583Fix a precision problem
Pipeline #26738 passed
...@@ -92,7 +92,7 @@ Int_t CbmStsSimSensor::ProcessPoint(const CbmStsPoint* point, Double_t eventTime ...@@ -92,7 +92,7 @@ Int_t CbmStsSimSensor::ProcessPoint(const CbmStsPoint* point, Double_t eventTime
Double_t tXav = 0.; Double_t tXav = 0.;
Double_t tYav = 0.; Double_t tYav = 0.;
// Int_t tZav = 0; // Int_t tZav = 0;
if (z2 - z1 != 0.) { if (abs(z2 - z1) > 0.000001) {
tXav = (x2 - x1) / (z2 - z1); tXav = (x2 - x1) / (z2 - z1);
tYav = (y2 - y1) / (z2 - z1); tYav = (y2 - y1) / (z2 - z1);
// tZav = 1; // tZav = 1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment