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位四精度浮点运算的时钟偏差补偿。这突显了另一种权衡:基于整数的分解算法具有有界补偿误差和较低的空间复杂度,而基于浮点运算的时钟偏差补偿因数字范围更宽而具有较低的溢出概率。