Issue 22090: Fix '%' formatting for infinities and NaNs.

--HG--
branch : 2.7