计算无效(android 工作室)

Calculation not working (android studio)

我有以下代码,为我正在编写的应用程序计算体脂,我不知道为什么按下 "Calculate" 按钮时结果总是 NaN,如果有人可以提供帮助,我会非常感谢!

String total1;

public void contaBfMasc(View v) {
    double alt2, cint2, pesco2;
    double conta;
    EditText alt1 = (EditText) findViewById(R.id.altura);
    EditText cint1 = (EditText) findViewById(R.id.cintura);
    EditText pesco1 = (EditText) findViewById(R.id.pescoco);
    TextView Result = (TextView) findViewById(R.id.totalBfMasc);

    alt2 = Float.parseFloat(alt1.getText().toString());
    cint2 = Float.parseFloat(cint1.getText().toString());
    pesco2 = Float.parseFloat(pesco1.getText().toString());

    conta = 495/(1.0324-0.19077*(Math.log10(cint2-pesco2))+0.15456*(Math.log10(alt2)))-450;
    total1 = String.format("%.2f", conta); 
    Result.setText(total1);
}

java.lang.Math.log10(double a) 方法returns double 值的以 10 为底的对数,a。适用特殊情况: 如果 a 为 NaN 或小于零,则结果为 NaN。

我怀疑 {alt2, cint2, pesco2} 中至少有一个是 NaN(cint2-pesco2) < 0