aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhannesw <none@none>2014-04-14 17:45:05 +0200
committerhannesw <none@none>2014-04-14 17:45:05 +0200
commit21a127ef32c5634863b2bd971f75f2540ebf65a2 (patch)
treefd4b0c53af95db96b444026181a968d8abcfd15e /src
parent19ba623793f5539d230677da57e7eaaf8941f486 (diff)
downloadnashorn-21a127ef32c5634863b2bd971f75f2540ebf65a2.tar.gz
8030200: Wrong result for Number.prototype.toString() for certain radix/inputs
Reviewed-by: sundar, jlaskey, lagergren
Diffstat (limited to 'src')
-rw-r--r--src/jdk/nashorn/internal/runtime/JSType.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/jdk/nashorn/internal/runtime/JSType.java b/src/jdk/nashorn/internal/runtime/JSType.java
index c49de9cf..11cecbfe 100644
--- a/src/jdk/nashorn/internal/runtime/JSType.java
+++ b/src/jdk/nashorn/internal/runtime/JSType.java
@@ -438,7 +438,9 @@ public enum JSType {
// encode integer part from least significant digit, then reverse
do {
- sb.append(chars.charAt((int) (intPart % radix)));
+ final double remainder = intPart % radix;
+ sb.append(chars.charAt((int) remainder));
+ intPart -= remainder;
intPart /= radix;
} while (intPart >= 1.0);