我想知道为什么我在使用以下代码时会失去精确性:
double x = 12.0456; // or float : same result
System.out.println(x); // outputs 12.0456 obviously
x %= 1; // should now be equal to 0.0456 right?
System.out.println(x); // outputs 0.04560000000000031 or 0.045599937 when using float
12.0456模1应该等于0.0456,对吗?但它所