我有我想要的功率到另一个BigDecimal的一个简单的BigDecimal,例如11.11 ^ -1.54。什么是做它的Java / Android的最巧妙的方法?我不喜欢转换成双打,因为它是医疗应用的想法,所以我会AP preciate最大的presicion可能。到目前为止,我已审查 http://commons.apache.org/math/ 并从谷歌数学的东西番石榴,但一无所获。
I have a simple BigDecimal that I want to power to another BigDecimal, for example 11.11^-1.54. What would be the neatest way to do it in Java/Android? I don't like the idea of converting to doubles because it is for a medical application, so I would appreciate the biggest presicion possible. So far I have reviewed http://commons.apache.org/math/ and math stuff from Google Guava, but found nothing.
编辑: 整个计算是复杂的,并且具有这样的许多操作。我需要尽可能多的precision在结束越好。
The whole calculation is complex, and has many operations like this. I need as much precision at the end as possible.
推荐答案
有关实用程序类的BigDecimal 的https:// github上.COM / tareknaj / BigFunctions
A utility class for BigDecimal https://github.com/tareknaj/BigFunctions
实例Z = X ^ÿ - > Z = EXP(LN(X)* Y)
Example for z = x^y --> z = exp ( ln(x) * y )
final int SCALE = 10;
BigDecimal x = new BigDecimal(1);
BigDecimal y = new BigDecimal(12);
BigDecimal z = BigFunctions.exp( BigFunctions.ln(x, SCALE).multiply(y),SCALE );
相关推荐
最新文章