我正在尝试寻找一个值的功率。但问题是我的指数是一个小数值.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
不..我想用相同的价值。我的意思是我需要那个小数值。我不能轮回或者改变价值。 –