I consider the following function: -x*exp(-x) - (1+exp(-x))*log(1+exp(-x))
It is a continuous function, but while plotting it in R I get a weird discontinuous graph over x from -38 to -34 (which is not really so low as to reach Inf/-Inf in the calculations). For example, the output for x=-37.36 and x=-37.38 is 0, but for x=-37.37 is -128. What could be the reason for this?
I am probably making some very basic error, but any help would be great. I have added the code and the plot.
Thanks!
x=seq(from=-38,to=-34,by=0.01)
kappa = -x*exp(-x) - (1+exp(-x))*log(1+exp(-x))
plot(x,kappa)