Open matteodelucchi opened 9 months ago
Instead of using the built-in exp
and trying to re-invent the wheel, we could use an existing library for multiple-precision floating-point computations, like https://www.mpfr.org/.
Good point! Just came across the long double version of exp() and I am not sure how mpfr differs from the expl()
?
From case study zero of the old abn-homepage.
MRE
The for-loop comparing INLA, internal C laplace and glm results, shows an over/underflow warning originating from laplace calculations in
node_binomial.c
. In different parts (e.g. line 940) , we exponentiate large numbers raising the overflow warning and resulting in Inf values which can lead to issues later down-stream.Suggested solution
The operation from line 940 appears in different locations in the code. Often they are marked with an old note regarding its potential to overflow. There is a note about a workaround in one place. Consider to investigate more on this workaround and check if the other parts of the code could be adapted accordingly or if there exists a better strategy (as the workaround doesn't seem to be the universal solution).