Fixes issue 8504

#8504 

While evaluation sum as euler maclaurin formula with limits as integers check whether the expression is polynomail or not.
According to the method's docstring "If the function is a polynomial of degree at most 2n+1, the
Euler-Maclaurin formula becomes exact".  This checks if the function is a polynomial, but @vramana it should probably also check the degree before continuing.