Open Bug 1846606 Opened 7 months ago Updated 7 months ago

parseFloat() and console.log("%f") disagree


(Core :: DOM: Core & HTML, defect)





(Reporter: domfarolino, Unassigned)


(Keywords: good-first-bug, parity-chrome, parity-safari)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Steps to reproduce:

Per the Console Standard, console.log("%f", ...) should delegate to ECMAScript's %parseFloat()%. All browsers agree that parseFloat(23) prints "23", however in Firefox, console.log("%f", 23) prints "23.000000" (i.e., including an unnecessary number of zeros). If console.log(%f) were truly delegating to parseFloat(), then their outputs should be the same.

Additionally, parseFloat(null) appropriately prints "NaN", which all browsers agree on. However, console.log("%f", null) prints 0.000000 ONLY in Firefox, which appears to be another spec deviation.

The Bugbug bot thinks this bug should belong to the 'DevTools::Console' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Console
Product: Firefox → DevTools
Component: Console → DOM: Core & HTML
Ever confirmed: true
Product: DevTools → Core
Severity: -- → S4
Keywords: good-first-bug
You need to log in before you can comment on or make changes to this bug.