答案是0而不是1,为什么?
public class Student {
public static void main(String[] args) {
double s=1.3901863961920014E-5;
int a= (int)s;
System.out.println("a: "+a);
}
}
答案 0 :(得分:3)
因为你的号码
1.3901863961920014E-5
是:
0.000013901863961920014013868597546608185666627832688391208648681640625
你可以尝试像这样检查全长:
double s = 1.3901863961920014E-5;
BigDecimal b = new BigDecimal(s);
System.out.println(b);
=> 0.000013901863961920014013868597546608185666627832688391208648681640625