Fixes issue 8504

#8504 

While evaluation sum as euler maclaurin formula with limits as integers check whether the expression is polynomail or not.
Sorry. I checked it just now `is_polynomial` works. I don't why I got that error while fixing this issue later but I never checked it later.