[fix](cast) wrong result while cast const to double then to string (#31657)

Issue Number: close #31514
This commit is contained in:
camby
2024-03-05 13:15:25 +08:00
committed by yiguolei
parent 5ed3c7eeef
commit 7998da4691
5 changed files with 13 additions and 0 deletions

View File

@ -137,6 +137,11 @@ public class FloatLiteral extends NumericLiteralExpr {
}
NumberFormat nf = NumberFormat.getInstance();
nf.setGroupingUsed(false);
if (type == Type.FLOAT) {
nf.setMaximumFractionDigits(7);
} else {
nf.setMaximumFractionDigits(16);
}
return nf.format(value);
}