简体   繁体   English

Java符号/ variable /

[英]Java- Notation for /variable/

When writing a method in java, I noticed that these two functions return the same value. 用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)));
}

What is 什么是

7.0/5760.0/t/t/t

doing? 在干嘛 Why is this the same as 7.0/(5760*t^3)? 为什么与7.0 /(5760 * t ^ 3)相同?

the expression 7.0/5760.0/t1/t2/t3 will be computed from LR. 表达式7.0 / 5760.0 / t1 / t2 / t3将根据LR计算。 like- 喜欢-

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

and r3 is your final result r3是您的最终结果

if you have expression like 8/2*2*2 it will be calculated as same i've explained earlier but in 8/2*(2*2) expression (2*2) will be calculated first because perathesis has higher priority then / . 如果您有像8/2*2*2这样的表达式,则其计算方法与我之前解释的相同,但是在8/2 8/2*(2*2)表达式(2*2)将首先计算,因为置换术的优先级更高,然后/ it is also aplly in case of math.pow() function because functions also have the higher priority the operators. math.pow()函数的情况下也是如此,因为函数的运算符优先级也更高。

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

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