JS: reduce precision of float constants

This commit is contained in:
Alexey Andreev 2019-05-13 17:39:18 +03:00
parent a1aa25afa0
commit 3d96616761
2 changed files with 6 additions and 6 deletions

View File

@ -216,14 +216,14 @@ public class TFloat extends TNumber implements TComparable<TFloat> {
}
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<TFloat> {
d *= d;
n /= 2;
}
return result;
return (float) result;
}
public static TFloat valueOf(TString s) throws TNumberFormatException {

View File

@ -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));
}
}
}