IIsi50MHz / chromey-calculator

A triaged calculator project exported from code.google.com/p/chromey-calculator
8 stars 7 forks source link

Add digit grouping - tabulation of long results (make long numbers readable) #29

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.200! 
2.
3.

What is the expected output? What do you see instead?
I wanted to see the result not as one long line of numbers.

What version of the product are you using? On what operating system?
3.2 linux

Please provide any additional information below.
It would be nice if the Chromey tabulated long results

Original issue reported on code.google.com by urim...@gmail.com on 18 Apr 2010 at 5:30

GoogleCodeExporter commented 9 years ago
For values up less than or equal to 170!, Google returns the result. Higher 
values are handled by WolframAlpha, which returns the long string of numbers.

http://m.wolframalpha.com/input/?i=200!

We should either add formatting to the result ("... 999 999 999.999 999 ..." or 
"...,999,999,999.999 999 ...") or use WolframAlpha's second result. The second 
result is a decimal approximation in scientific notation.

Original comment by iisi50...@gmail.com on 28 Sep 2010 at 11:46

GoogleCodeExporter commented 9 years ago

Original comment by iisi50...@gmail.com on 1 Oct 2010 at 8:01

GoogleCodeExporter commented 9 years ago
Issue 76 has been merged into this issue.

Original comment by iisi50...@gmail.com on 1 Oct 2010 at 8:02

GoogleCodeExporter commented 9 years ago
Incrementing priority and taking ownership because this is a long-standing 
issue. Trying to clear out old bugs and stuff.

Original comment by iisi50...@gmail.com on 10 Dec 2011 at 7:57

GoogleCodeExporter commented 9 years ago
For a start, insert this between lines 686 and 685 of bwr_calc.js:

[code]
output.display = output.display.replace(/(\.\d+)|(?=(?:\d{3})+\b)(?!\b)/g, 
function(m, $1) { return $1 || ',' });
output.plain = output.plain.replace(/(\.\d+)|(?=(?:\d{3})+\b)(?!\b)/g, 
function(m, $1) { return $1 || ',' });
[/code]

Now find ways to break it!

Also, the literal comma should be replaced with a variable that is set 
according to number format that belongs to the browser locale 
(navigator.language). Doesn't take the decimal into account either, so that too 
would need to changer per locale.

Original comment by iisi50...@gmail.com on 10 Dec 2011 at 10:42

GoogleCodeExporter commented 9 years ago
Simple breakage: send "woodchuck wood" or "japanese emperor's birthday, then 
watch the year get mangled. )-:

I guess other calculators get around this by not having anything to do with 
dates!

Original comment by iisi50...@gmail.com on 10 Dec 2011 at 10:52