我正在嘗試尋找一個值的功率。但問題是我的指數是一個小數值.power函數不支持int以外的任何數據類型。如何在電源功能中使用雙精度值
BigDecimal fd_returns_at_time_of_replace=(BigDecimal.valueOf(capitalDiff).multiply((BigDecimal.valueOf((long)constant1+.09)).pow(temp)));
這裏temp是一個小數值。下面是我得到的eror消息。
The method pow(int) in the type BigDecimal is not applicable for the arguments (double)
請有人幫我做到這一點。
然後傳遞'int'類型作爲參數或類型強制轉換'double'到'int'。 –
可能的重複http://stackoverflow.com/questions/3579779/how-to-do-a-fractional-power-on-bigdecimal-in-java – spatulamania
不..我想用相同的價值。我的意思是我需要那個小數值。我不能輪迴或者改變價值。 –