繁体   English   中英

Java符号/ variable /

[英]Java- Notation for /variable/

用Java编写方法时,我注意到这两个函数返回相同的值。

// Riemann-Siegel theta function using the approximation by the Stirling series
public static double theta (double t) {
return (t/2.0 * StrictMath.log(t/2.0/StrictMath.PI) - t/2.0
    - StrictMath.PI/8.0 + 1.0/48.0/t + 7.0/5760.0/t/t/t);
}

// Riemann-Siegel theta function using the approximation by the Stirling series
public static double theta2 (double t) {
return (t/2.0 * Math.log(t/(2.0*Math.PI)) - t/2.0
    - Math.PI/8.0 + 1.0/(48.0*Math.pow(t, 1)) + 7.0/(5760*Math.pow(t, 3)));
}

什么是

7.0/5760.0/t/t/t

在干嘛 为什么与7.0 /(5760 * t ^ 3)相同?

表达式7.0 / 5760.0 / t1 / t2 / t3将根据LR计算。 喜欢-

r=(7.0/5760.0)
r1=(result/t1)
r2=(r1/t2)
r3=(r2/t3)

r3是您的最终结果

如果您有像8/2*2*2这样的表达式,则其计算方法与我之前解释的相同,但是在8/2 8/2*(2*2)表达式(2*2)将首先计算,因为置换术的优先级更高,然后/ math.pow()函数的情况下也是如此,因为函数的运算符优先级也更高。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM