Incorrect result when logging subnormal floating-point number to console. · Issue #17500 · nodejs/node (original) (raw)
- Version: 8.9.1, 8.9.2, 9.x
- Platform: Linux d0cc2382da37 4.4.0-101-generic 124-Ubuntu SMP Fri Nov 10 18:29:59 UTC 2017 x86_64 Linux
- Subsystem: console
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.