[Dojo-checkins] [dojo] #35: incorrect log10 implementation
dojo-checkins at dojotoolkit.org
dojo-checkins at dojotoolkit.org
Fri Jul 15 23:30:57 PDT 2005
#35: incorrect log10 implementation
---------------------+------------------------------------------------------
Id: 35 | Status: new
Component: General | Modified: Fri 15 Jul 2005 11:30:56 PM PDT
Severity: normal | Milestone:
Priority: normal | Version:
Owner: alex | Reporter: Dmitry
---------------------+------------------------------------------------------
Hello,
your javascript log10 implementation could lead to
rounding errors and is incorrect.
Use this instead(look for idea or cut-n-paste):
function uc_log10_floor(n) {
n = String(n).toLowerCase();
var a1 = n.split('e'), a2 = a1[0].split('.');
return a2[0].length + (a1[1] ? parseInt(a1[1], 10) : 0) - 1 }
Regards, Dmitry, accelware at accelware.com
--
Ticket URL: <http://dojotoolkit.org/trac/ticket/35>
dojo <http://dojotoolkit.org/>
The Dojo UI Toolkit
More information about the Dojo-checkins
mailing list