Take this Mathematica code:
f[x_] := Exp[-x];
c = 0.9;
g[x_] := c*x^(c - 1)*Exp[-x^c];
SetPrecision[Integrate[f[x]*Log
In julia, the QuadGK package can do these integrals. Just doing this directly you will bump into issues, as you note:
f(x) = exp(-x)
g(x; c=0.9) = c*x^(c - 1)*exp(-x^c)
h(x) = f(x) * log(f(x)/g(x))
using QuadGK
a,b = 0.001, Inf
quadgk(h, a, b) # errors
But expanding the log(f/g) to log(f) - (log(c) + (c-1)log(x) + x^c) we can get each term to integrate:
c = 0.9
quadgk(x -> f(x) * -x, a,b)
quadgk(x -> -f(x)*log(c), a,b)
quadgk(x -> -f(x)*(c-1)*log(x), a,b)
quadgk(x -> f(x) * x^c, a,b)
Adding up the values gives the answer.
You can also get the answer by filtering out the NaN values, which may be much more inefficient:
h1(x) = isnan(h(x)) ? 0.0 : h(x)
quadgk(h1, a,b) # (0.010089328699390816, 9.110982026738999e-11)
Using big(a) and big(b) can get you more decimal points.