| Summary: | wrong value with leading zero in toFixed() function | ||
|---|---|---|---|
| Product: | [Applications] konqueror | Reporter: | Nikolay Pavlov <qpadla> |
| Component: | kjs | Assignee: | Konqueror Bugs <konqueror-bugs-null> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | unspecified | ||
| OS: | FreeBSD | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
SVN commit 656293 by porten: Fixed off-by-one digit error in toFixed(). Already fixed in trunk. BUG: 144115 M +6 -0 ChangeLog M +1 -1 number_object.cpp --- branches/KDE/3.5/kdelibs/kjs/ChangeLog #656292:656293 @@ -1,3 +1,9 @@ +2007-04-20 Harri Porten <porten@kde.org> + + * number_object.cpp: fixed leading-zero loss on toFixed() call by + following the spec algorithm properly. Nikolay Pavlov's bug + report: http://bugs.kde.org/144115. + 2007-03-13 Harri Porten <porten@kde.org> * function.cpp (decodeURI): don't drop last character of unescaped --- branches/KDE/3.5/kdelibs/kjs/number_object.cpp #656292:656293 @@ -241,7 +241,7 @@ UString m = integer_part_noexp(n); int k = m.size(); - if (m.size() < f) { + if (k <= f) { UString z = ""; for (int i = 0; i < f+1-k; i++) z += "0"; |
Version: 3.5.6 (using KDE 3.5.6, compiled sources) Compiler: gcc version 3.4.6 [FreeBSD] 20060825 OS: FreeBSD (i386) release 7.0-CURRENT Try this code on konqueror: <script> var kk = 0.1234; function proc() { alert ("Leading zero was lost somehow, value is " + kk.toFixed(4) + ", but should be " + kk); } </script> <input type="button" value="Process" onclick="proc()" />