Solved by albanD in post #2 
              
              
                Hi, 
It is actually the whole point of having a single function that does log + sum + exp, it is much more precise than doing them one after the other. 
The trick is to remove the maximum value from the values in the exp. You can move it out of the sum and do log(exp(max_val)) = max_val. And the onl…