的BigDecimal为BigDecimal的基于Java的电源/ Android的 [英] BigDecimal to the power of BigDecimal on Java/Android

查看:180
本文介绍了的BigDecimal为BigDecimal的基于Java的电源/ Android的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我想要的功率到另一个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 );

这篇关于的BigDecimal为BigDecimal的基于Java的电源/ Android的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆