usMoney method passes off to Ext.util.Format.currency which passes off to Ext.util.Format.number. The number method performs rounding based on the format accepted as its second argument. The problem is that it deals with floating point math and this is sometimes not accurate enough.
Steps to reproduce the problem:
In chrome console, try Ext.util.Format.number(20.775, "0.00")
Now try Ext.util.Format.number(20.776, "0.00")
The result that was expected:
In both cases stated above the expected result is "20.78", whether the round method is ROUND_HALF_UP or ROUND_HALF_EVEN it should go to "20.78"
The result that occurs instead:
Ext.util.Format.number(20.775, "0.00"); // returns "20.77" expected "20.78"
Ext.util.Format.number(20.776, "0.00"); // returns "20.78" which is expected
My personal fix involved pulling in a JS library known as Big.js and use a custom renderer where I need it (numberfields in my grids) to set the value of 20.775 to $20.78 in my grid. Sencha could do something similar in building something like Big.js internally and making the usMoney method pass to this arbitrary decimal precision library. I don't feel like it's appropriate to leave currency formatting up to floating point math.
Additional CSS used:
only default ext-all.css
Win 7 Enterprise x64
Last edited by caleywoods; 24 Jul 2013 at 12:31 PM.
Reason: version info added
Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."