It's never a good idea to abuse parseInt when what you actually want is
Math.round, Math.ceil or Math.floor. parseInt ignores everything from
the first non-digit character, so if numerical operations lead to
surprising results, parseInt may return something undesired, as in your
case.

So the original line in NumberFormat.js is more of a hack than your
solution. I wrote a test to see which method is faster, and - hooray -
it's yours.

> Okay, what if we changed line 90 of NumberFormat.js from:
>     var integerDigits = Math.max(parseInt(Math.log(num) / 
> Math.LN10) + 1, 1);
> to:
>     var integerDigits = (String(Math.floor(num)).length); 
> That should always give the appropriate length, though it is 
> a little more of a hack. I've tested it out a bit myself, and 
> it seems to work alright.
> Any thoughts?

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to