Math calculation in address bar gives a wrong answer when digit grouping separator (,) is used
Categories
(Firefox :: Address Bar, enhancement, P3)
Tracking
()
People
(Reporter: nobuto, Unassigned)
References
Details
(Whiteboard: [sng][eng-implementation-ready])
Attachments
(1 file)
|
18.96 KB,
image/png
|
Details |
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:147.0) Gecko/20100101 Firefox/147.0
Steps to reproduce:
Put "100,000/1,000,000" into the address bar (100 thousands divided by 1 million)
(this math function is covered by this user article: https://support.mozilla.org/en-US/kb/solve-math-calculations-directly-your-firefox-addr)
Actual results:
Firefox returns 0.0001 (though Google returns 0.1)
Expected results:
Both Firefox and Google return 0.1
Comment 1•3 days ago
|
||
The Bugbug bot thinks this bug should belong to the 'Firefox::Address Bar' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Comment 2•2 days ago
|
||
Unfortunately the separators are different depending on the locale, parseFloat uses dots, and people tend to mixup all kind of notation.
So obvisouly there is an heuristic, and ours differs from Google's. Thus, I'm calling this an enhancement because there's no perfect heuristic.
In this case what we could do is once we hit any number that has a strong indicator of which notation is used (in this case 100,000,000 tells us that comma is used as thousands separator) we should use that strong indication for all the numbers.
If there's no strong indication, we'd continue using the heuristic per number.
That requires a 2-pass heuristic where first-pass looks for strong notation signal, and second pass uses that info.
Updated•2 days ago
|
Description
•