fix(math/poly/fft): 修改递归版 FFT 代码实现 #5573
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
原来的 FFT 中,定义了旋转角度
step
,并通过cur *= step
不断计算下一个单位根。这种做法会随着循环逐渐累积浮点数的精度误差,最终误差太大,在洛谷模板题 P3803 会 WA。因此修改为直接调用 sin,cos 计算每一次的单位根。