Open Bug 2010516 Opened 3 days ago Updated 2 days ago

Math calculation in address bar gives a wrong answer when digit grouping separator (,) is used

Categories

(Firefox :: Address Bar, enhancement, P3)

Firefox 147
enhancement

Tracking

()

UNCONFIRMED

People

(Reporter: nobuto, Unassigned)

References

Details

(Whiteboard: [sng][eng-implementation-ready])

Attachments

(1 file)

Attached image address_bar_math.png

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

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.

Component: Untriaged → Address Bar

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.

Severity: -- → N/A
Type: defect → enhancement
Priority: -- → P3
Whiteboard: [sng][eng-implementation-ready]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: