updating stan/prob/internal_math function to throw an exception when the sum diverges