[core] Fix sprintf width for NaN/Inf/-Inf, GH #1100

Add the missing width handling, and add tests.
for perl6 RT 116280, from https://github.com/perl6/roast/commit/2647c16652