如何在java/groovy中进行此计算?

Ara*_*ram -3 java algorithm math groovy

我想要一个可以执行以下计算并返回结果的函数.我不确定这个统计公式中的e意味着什么.我不知道如何将该公式转换为java代码...这就是问题...特别是e power points .... points是一个变量,我将作为函数arg传入

在此输入图像描述

这不是功课.

Вит*_*вич 5

正如Corbin所说,你可以在Java中找到你的常量java.lang.Math.E.

但是你可能想要使用这个Math.exp(Double d)方法.

你的计算是:

 ePoints = Math.exp(Points);
 finalScore = 1000 * (ePoints/(1 + ePoints)) - 10;
Run Code Online (Sandbox Code Playgroud)

通过使用以下方法,您可以获得更高的精度,但更高的溢出风险:

 ePoints = Math.exp(Points);
 finalScore = (1000 * ePoints)/(1 + ePoints) - 10;
Run Code Online (Sandbox Code Playgroud)