我正在使用以下代码:
//Calculating Profit and Loss
float difference= sell_amount-buy_amount;
if (flag == 0) {
if ((difference<0)) {
System.out.print("Loss ");
System.out.println(difference - total_extra);
} else {
System.out.println("Profit ");
System.out.println(difference - total_extra);
}
}
即使在某些输入中,输出为-0.53,它仍然显示利润..我哪里出错了