1
私はデータ型doubleの変数を2つ持っています。これらの変数に科学的な形式で結果を返しますが、人間の読める形式で結果を表示する必要があります。例については :私は9854795と8.9を掛けたときに ではなく、ここで87707675.5二重変数の値を科学的表記なしで表示する
の8.77076755E7が値を計算するための私の関数であるとの結果を返します。
private void calculatingTotalPaymentAmount() {
if (editTextBookingQuantity.getText().toString().equals(""))
{
editTextBookingQuantity.setError("Enter Booking Quantity to calculate Total Payment Amount");
return;
} else if (editTextRatePerBrick.getText().toString().equals(""))
{
editTextRatePerBrick.setError("Enter Rate Per Brick to calculate Total Payment Amount");
return;
} else {
//MathContext mc = new MathContext(4); // 4 precision
final double catchBookingQtyDoubleForm = Double.parseDouble(editTextBookingQuantity.getText().toString());
final double catchRatePerBrickDoubleForm = Double.parseDouble(editTextRatePerBrick.getText().toString().trim());
final double totalPaymentAmount = (catchBookingQtyDoubleForm * catchRatePerBrickDoubleForm);
//bg3 = bg1.multiply(bg2, mc);
//BigDecimal newValue = totalPaymentAmount.setScale(0, RoundingMode.DOWN);
editTextTotalPaymentAmount.setText(""+totalPaymentAmount);
}
}
ダブルtotalPaymentAmount BigDecimalのチェックにそれを変更 – Lingeshwaran