cpmodel / FTT_StandAlone

Future Technology Transformation models
GNU General Public License v3.0
9 stars 1 forks source link

TANH function different between python and Fortran #85

Closed AEdwards476 closed 4 months ago

AEdwards476 commented 4 months ago

When calculating isReg all the inputs are the same (e.g., time_lag['HEWS'] in python = HWSL in Fortran and data['HREG'] in python = HREG in Fortran) yet outputs are different, so the only explanation seems to be that TANH is going wrong. Having done the calculation manually it seems that it is going wrong in Fortran.

However, TANH is only going wrong for isReg, there is no issue when using TANH to calculate consumer preferences

Femkemilene commented 4 months ago

We examined this a bit further, using another FORTRAN compiler. The differences remain, and are around 20%, but only occur for outputs of around 10**-8, which is basically zero in both cases, so shouldn't noticeably change the output of the model.