diff --git a/classlib/src/main/java/org/teavm/classlib/java/lang/TFloat.java b/classlib/src/main/java/org/teavm/classlib/java/lang/TFloat.java index 30c66ee2c..3bef4255d 100644 --- a/classlib/src/main/java/org/teavm/classlib/java/lang/TFloat.java +++ b/classlib/src/main/java/org/teavm/classlib/java/lang/TFloat.java @@ -216,14 +216,14 @@ public class TFloat extends TNumber implements TComparable { } private static float decimalExponent(int n) { - float d; + double d; if (n < 0) { - d = 0.1f; + d = 0.1; n = -n; } else { d = 10; } - float result = 1; + double result = 1; while (n != 0) { if (n % 2 != 0) { result *= d; @@ -231,7 +231,7 @@ public class TFloat extends TNumber implements TComparable { d *= d; n /= 2; } - return result; + return (float) result; } public static TFloat valueOf(TString s) throws TNumberFormatException { diff --git a/core/src/main/java/org/teavm/backend/javascript/rendering/RenderingContext.java b/core/src/main/java/org/teavm/backend/javascript/rendering/RenderingContext.java index 50f9073da..40916531f 100644 --- a/core/src/main/java/org/teavm/backend/javascript/rendering/RenderingContext.java +++ b/core/src/main/java/org/teavm/backend/javascript/rendering/RenderingContext.java @@ -231,10 +231,10 @@ public class RenderingContext { float value = (Float) cst; if (value < 0) { writer.append("("); - writer.append(Float.toString(value)); + writer.append(Double.toString((double) value)); writer.append(")"); } else { - writer.append(Float.toString(value)); + writer.append(Double.toString((double) value)); } } }