分裂时的奇怪行为

时间:2013-03-31 21:43:46

标签: actionscript-3 flash operators

快速提问,但它让我发疯了:

不是这个:

return c*(t/=d/2)*t*t + b;

与:

相同
t = t/d/2;
return c*(t)*t*t + b;

因为它似乎不是,我得到了不同的结果。

1 个答案:

答案 0 :(得分:1)

/运算符是左关联的。这意味着

t = t/d/2;

与:

相同
t = (t/d)/2;

当然,

t /= d/2;

致力于:

t = t/(d/2);

Actionscript的文档:http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b90204-7fd1.html#WS5b3ccc516d4fbf351e63e3d118a9b90204-7f68

相关问题