In recent work, Lemire (2021) presented a fast algorithm to convert number strings into binary floating-point numbers. The algorithm has been adopted by several important systems: e.g., it is part of the runtime libraries of GCC 12, Rust 1.55, and Go 1.16. The algorithm parses any number string with a significand containing no more than 19 digits into an IEEE floating-point number. However, there is a check leading to a fallback function to ensure correctness. This fallback function is never called in practice. We prove that the fallback is unnecessary. Thus we can slightly simplify the algorithm and its implementation.
翻译:在近期研究中,Lemire(2021)提出了一种将数字字符串转换为二进制浮点数的快速算法。该算法已被多个重要系统采用:例如,它被纳入GCC 12、Rust 1.55和Go 1.16的运行时库中。该算法可将有效数字不超过19位的任意数字字符串解析为IEEE浮点数。然而,算法中存在一处检查,会触发一个用于确保正确性的回退函数。该回退函数在实际中从未被调用。我们证明了该回退函数并无必要,因此可以略微简化该算法及其实现。