Excel 使用什么算法重新计算公式? [英] What algorithm does Excel use to recalculate formulas?

查看:26
本文介绍了Excel 使用什么算法重新计算公式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否在语法树中表示的公式然后使用像访问者这样的设计模式重新计算图案?您将如何在代码中重现重新计算过程?

Are the formulas represented in a syntax tree then recalculated using a design pattern like the Visitor pattern? How would you go about reproducing the recalculation process in code?

推荐答案

可能,如你所说,一个猜测是 Excel 创建了一堆 AST,一个用于每个独立的单元格组,其中叶子是原始的、静态的数据,节点是公式.

Probably, as you say, one guess is that Excel creates a bunch of ASTs, one for each indipendent group of cells, where the leaves are the originating, static data, and the nodes are formulas.

然后用后序树计算每个节点的结果遍历算法.

Then it calculates the result for each node, with a post-order tree traversal algorithm.

您必须考虑叶/节点取消、部分重新计算、ecc.如果我没记错的话,我在某处读到 Excel 可以受益于多核处理器并行重新计算工作表.

You have to take into account leaf/node cancellation, partial recalculation, ecc. If I'm not wrong, I read somewhere that Excel could benefit of multicore processors to recalculate a sheet in parallel.

这篇关于Excel 使用什么算法重新计算公式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆