有花车:
float a; float b; double result = 1 + a*b;
双打:
double a; double b; double result = 1 + a*b;
float a = 16777217; // Largest int exactly representable in a float. float b = 16777217; System.out.println((double)(1 + a*b)); double c = 16777217; double d = 16777217; System.out.println(1 + c*d);
输出(Ideone):
2.81474976710656E14 2.8147501026509E14
所以是的,使用float会导致精度下降.