Incorrect result when logging subnormal floating-point number to console. · Issue #17500 · nodejs/node (original) (raw)

@ealmansi

Logging a subnormal floating-point number to console prints -0 instead of the correct number when passed as first argument to console.log. It prints the correct number if passed in as the second argument.

Steps to reproduce:

$ node
console.log(-5e-324);
console.log('', -5e-324); 

Expected output:

-5e-324
-5e-324

Actual output:

-0
-5e-324

Additional info:
I tested this code sample and can confirm incorrect output for versions 8.9.1, 8.9.2, and 9.x.
The same code sample produces the expected output in version 8.3.