As of now if g:formatNumber is used with NaN value, the default value of DecimalFormatSymbols is returned (\uFFFD). This does not look nice in HTML output.
We should have a way to customize the appearance of NaN values on the webpage. This could be easily done by adding a new attribute:
Obviously the Output should be "n/a"
I've already fixed this locally and send a pull request soon.