gpt4 book ai didi

c++ - C/C++ 代码 2nd = 登录操作

转载 作者:太空宇宙 更新时间:2023-11-04 05:01:57 26 4
gpt4 key购买 nike

我不确定这是 C 还是 C++ 代码,但我认为这不重要。

在这段代码中:

x -= (t = u/(1.-0.5*MIN(1.,u*(a1/x - b1/(1.-x)))));

t = u 是什么意思?它没有将 t 分配给 u 是吗?因为它没有意义,因为它实际上在上一行中设置为其他内容:

t = exp(a1*log(x)+b1*log(1.-x) + afac);
u = err/t;
x -= (t = u/(1.-0.5*MIN(1.,u*(a1/x - b1/(1.-x)))));
if (x <= 0.) x = 0.5*(x + t);
if (x >= 1.) x = 0.5*(x + t + 1.);

最佳答案

what does the t = u mean?

它是一个更大的子表达式的一部分,

t = u/(1.-0.5*MIN(1.,u*(a1/x - b1/(1.-x))))

It's not assigning t to u is it?

不是,它是把那个复杂表达式的值赋给t。然后在完整的表达式中使用该赋值的结果:

x -= (t = <stuff> );

从概念上讲,这与:

t = <stuff>
x = x - t

Because it wouldn't make sense then since it's actually getting set to something else in the previous line

坦率地说,整套陈述对我来说没有意义。无论如何,t 在第一行设置,在第二行使用,并在第三行再次设置。

关于c++ - C/C++ 代码 2nd = 登录操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10030098/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com