Avoid "NaN" output

It uses a custom number format function to avoid "NaN%" outputs.