在Java中,您可以使用strictfp跨平台实施浮点确定性。 Android上是否存在这样的实现?如果有,您如何使用它?
最佳答案
您可以像在普通Java中一样使用它。例:
public class TestStrictfp {
strictfp double computeTotal(double x, double y) {
return x + y;
}
}
并像这样使用它:
TestStrictfp o = new TestStrictfp();
double d = o.computeTotal(1, 2);