sprintf.js icon indicating copy to clipboard operation
sprintf.js copied to clipboard

Fix NaN being printed out as `-NaN`

Open Wain-PC opened this issue 4 years ago • 0 comments

I've encountered incorrect behavior in cases involving NaN. Consider the following example:

sprintf('%f', NaN) // '-NaN'

The library always adds minus sign before NaN. This fix considers NaN as a positive by including an additional check during sign detection.

Wain-PC avatar Nov 22 '21 11:11 Wain-PC