我有以下输入:
37107287533902102798797998220837590246510135740250 46376937677490009712648124896970078050417018260538 74324986199524741059474233309513058123726617309629 91942213363574161572522430563301811072406154908250 23067588207539346171171980310421047513778063246676
我想把它存储起来,保持至少 10sf 的精度。
我的代码:
BufferedReader br = null;
DecimalFormat d = new DecimalFormat("#");
try {
br = new BufferedReader(new FileReader(file));
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
System.out.println(e);
}
while(br.readLine() != null) {
String x = d.format(Double.parseDouble(br.readLine()));
System.out.println(x);
}
但是,此时我可以将 x 转换为双倍保持精度吗?
谢谢 :)