Search papers, labs, and topics across Lattice.
The authors present a fully branch-free, pure floating-point variant of the Payne-Hanek range reduction algorithm for large double-precision inputs ($|x| \ge 2^{16}$) optimized for fused multiply-add (FMA) hardware. Standard implementations create major pipeline bottlenecks because they depend on multi-word integer arithmetic and heavy branching that severely inhibit SIMD vectorization. Leveraging an exponent-indexed compact lookup table under a formal truncation error budget, the routine guarantees accuracy within one ulp for all inputs, substantially improving throughput and latency in LLVM libc.
Large-input trigonometric reduction no longer needs to stall SIMD pipelines with multi-word integer branches, achieving single-ulp accuracy purely through branchless FMA floating-point math.
Range reduction plays a crucial role in the accuracy and performance of evaluating trigonometric functions, and is often the primary bottleneck for large floating-point inputs. While fast algorithms such as Cody--Waite work efficiently over narrow intervals, the Payne--Hanek algorithm remains the standard technique for accurate reduction across large floating-point inputs. However, existing implementations of Payne--Hanek suffer from high latency due to heavy branching, conversion overheads, and the use of multi-word integer arithmetic, which hinders SIMD vectorization. In this paper, we analyze and present a branch-free variation of the Payne--Hanek algorithm using only floating-point arithmetic. Our method operates directly over large double-precision inputs ($|x| \ge 2^{16}$) and is well suited to hardware with FMA instructions. We formulate the precision constraints in terms of a truncation error budget, construct a compact lookup table indexed by the input exponent, and prove that the reduced argument is accurate to within one ulp for every input. The same routine can serve both as the complete range reduction of a single-stage implementation and as the fast path of a correctly rounded one, and it improves both latency and throughput over existing implementations. The algorithm is currently implemented in the LLVM libc project.