DCPROGS / HJCFIT

Full maximum likelihood fitting of a mechanism directly to the entire sequence of open and shut times, with exact missed events correction.
GNU General Public License v3.0
7 stars 4 forks source link

Looking at fortran differences with c++ #141

Closed jenshnielsen closed 8 years ago

jenshnielsen commented 8 years ago

At start the first burst in the first element 1 of 1480

In C++: 5.14523074792812 Python: 5.145230747928122 In Fortran: 5.14523591809450

jenshnielsen commented 8 years ago

Initial vector CHS Python

array([[ 0.1286805876299873,  0.3248110200910663,  0.5465083922789464]], dtype=float128)

Fortran

0.1286833609395, 0.3248116044, 0.5465050346
jenshnielsen commented 8 years ago

I have been debugging the Fortran code and it looks like the differences are due to the fact that the fortran code contains a number of single precision variables. Without working through the entire code base it’s hard to be sure but for instance when the CHS vector is calculated in Hjclik.for it is proportional exp(root * (tcrit-tres)) and both tcrit and tres are cast to double(real*8) from single precision variables so they will contain random garbage after the first 8 digits or so. I.e. in the example I am debugging tres = 3.000000119209290e-5 in the fortran version