Fixes issue 8504

#8504 

While evaluation sum as euler maclaurin formula with limits as integers check whether the expression is polynomail or not.
Is there are reason not to call `is_polynomial` instead of the private version?