We formulate the problem of clock skew compensation as a special case of the integer linear scaling in the form of iD/A and propose two algorithms -- i.e., the multiplicative decomposition of integer division (MDID) and the additive decomposition of direct search (ADDS) -- for its nearest integer solution, which are not only immune to floating-point precision loss but also non-incremental unlike our prior approaches based on Bresenham's algorithm. Having theoretically established both decomposition algorithms based on a unified and rigorous formulation of the problem of the integer linear scaling rounded to the nearest integer, we discuss the space-time trade-off through the analysis of their computational complexities and non-overflow conditions. Through the numerical examples in a practical context of clock skew compensation under two different scenarios based on 32-bit and 64-bit integers, we observe that MDID can obtain the nearest integer solutions with the complexity of O(1) when D is much smaller than the maximum value of the underlying integer type but overflows otherwise; in comparison, ADDS can handle all the cases under both scenarios without overflows but at the expense of increased computational complexity when i approaches the maximum value of the underlying integer type. We also observe that ADDS based on 32-bit integers is equivalent to the clock skew compensation based on 64-bit double-precision floating-point arithmetic, while both algorithms based on 64-bit integers are equivalent to the clock skew compensation based on 128-bit quadruple-precision floating-point arithmetic, which highlights another trade-off between the bounded compensation errors and lower space complexity of the integer-based decomposition algorithms and the lower chances of overflows resulting from the wide ranges of numbers of the clock skew compensation based on floating-point arithmetic.
翻译:我们将时钟偏差补偿问题形式化为整数线性缩放的一个特例(形式为 iD/A),并提出两种算法——即整数除法的乘法分解(MDID)和直接搜索的加法分解(ADDS)——用于求解其最近整数解。这些算法不仅避免了浮点精度损失,且不同于我们先前基于 Bresenham 算法的增量式方法,具有非累积性。在基于统一且严谨的问题形式化(即四舍五入到最近整数的整数线性缩放)从理论上建立两种分解算法后,我们通过分析其计算复杂度与无溢出条件,探讨了时空权衡。通过基于 32 位和 64 位整数的两种实际时钟偏差补偿场景的数值实例,我们观察到:当 D 远小于底层整数类型最大值时,MDID 能以 O(1) 复杂度获得最近整数解,但在其他情况下会发生溢出;相比之下,ADDS 在两种场景下均能无溢出地处理所有情况,但随着 i 接近底层整数类型最大值,其计算复杂度会上升。我们还发现,基于 32 位整数的 ADDS 等价于基于 64 位双精度浮点运算的时钟偏差补偿,而基于 64 位整数的两种算法均等价于基于 128 位四精度浮点运算的时钟偏差补偿。这凸显了另一种权衡:基于整数的分解算法能以较低的补偿误差和空间复杂度,换取基于浮点运算的时钟偏差补偿因数值范围更广而带来的更低溢出风险。