Avoid `Real` overflow in `middle`
Merge pull request #8077 from kshramt/kshramt/overflow

Avoid `Real` overflow in `middle`