Correctly rounded vector implementation of the exponential function in binary64 arithmetic

Nicolas Brisebarre, Tom Hubrecht, Christoph Lauter, Jean-Michel Muller, Kristalys Ruiz-RohenaSPIRE 2026

TL;DR

This paper presents the first correctly rounded vector implementation of the exponential function for binary64 floating-point arithmetic. By leveraging compiler auto-vectorization and a novel two-path approach (fast and accurate), they achieve performance comparable to state-of-the-art scalar libraries while ensuring mathematical correctness.

What Problem Does This Paper Address?

The IEEE 754 standard for floating-point arithmetic specifies how basic mathematical functions like the exponential should behave. "Correct rounding" means that the computed result is the closest possible floating-point number to the true mathematical result. While correctly rounded scalar functions have been available for some time, achieving this for vectorized operations (where multiple calculations happen in parallel) has been a significant challenge. Vectorized implementations often sacrifice correctness for speed, leading to subtle but potentially critical errors in scientific computations. This paper tackles the problem of developing a vectorized exponential function that is both fast and, crucially, correctly rounded.

Methods

The core of the solution lies in a two-path approach, inspired by scalar implementations but adapted for vector processing:

  • Fast Path: This path is designed for maximum speed and avoids element-wise tests to prevent divergence across vector lanes. It uses a range reduction technique to bring the input into a smaller, manageable interval. A polynomial approximation is then used to estimate the exponential. The key innovation here is the adaptation of rounding tests for vector operations, using a "vector rounding test" that checks the entire vector at once.
  • Accurate Path: This path is invoked only when the fast path cannot guarantee correct rounding. Instead of implementing a complex vectorized accurate path, the authors opt to call a scalar accurate path. This is a pragmatic choice, as the accurate path is expected to be rarely needed, and its performance impact is minimized.
  • Auto-Vectorization: A significant aspect of their methodology is relying on modern compilers to automatically vectorize the C code. This means they write portable C code, and the compiler handles the generation of SIMD (Single Instruction, Multiple Data) instructions, making the implementation broadly applicable.
  • Double-Word (DW) and Triple-Word (TW) Arithmetic: To maintain precision during intermediate calculations, especially in the range reduction and polynomial evaluation, the authors employ specialized DW and TW arithmetic routines. These routines represent numbers as sums of two or three floating-point numbers, allowing for more accurate intermediate results.

Datasets

The paper does not introduce new datasets. Instead, it uses:

  • Worst-case test cases: A database of "hardest-to-round" cases for the exponential function is used to rigorously test the implementation's correctness.
  • Randomly generated inputs: For performance evaluation, vectors of inputs are generated with exponents drawn uniformly from a specific range and significands/signs drawn uniformly. This approach aims to provide a more realistic distribution of inputs than simply covering the entire exponent range, which would disproportionately favor values near zero.

Key Insights and Ideas

  • Feasibility of Vectorized Correct Rounding: The paper demonstrates that achieving correctly rounded vectorized elementary functions is indeed feasible, not just theoretically but with practical performance benefits.
  • Compiler Auto-Vectorization is Powerful: By writing portable C and relying on the compiler, they show that modern compilers can effectively generate efficient SIMD code for complex mathematical functions, reducing the need for architecture-specific intrinsics.
  • The "Accurate Path" Trade-off: The decision to use a scalar accurate path when needed is a clever compromise. It keeps the fast path clean and efficient while still ensuring correctness, as the accurate path's overhead is amortized over many fast-path computations.
  • Vector Rounding Test Necessity: Standard scalar rounding tests are not directly applicable to vectors. The development of a "vector rounding test" that operates on the entire vector is a crucial step for enabling correct rounding in a vectorized context.
  • The "One Hard Case": A surprising finding was that out of a vast number of test cases, only one specific input failed the initial correctness check, highlighting the robustness of their approach but also the need for specialized handling of such edge cases.

Key Results

  • Correct Rounding: The implementation is demonstrated to be correctly rounded for binary64 arithmetic, with only one specific input requiring special handling.
  • Performance: On an Intel i7-1260P processor, their implementation achieved an average cycle count of 5.5 cycles per vector element (fast path) and 9.8 cycles (full path), which is competitive with or better than state-of-the-art scalar libraries and a previous vectorized implementation (Lauter [28]). Similar performance was observed on AMD Zen4 processors.
  • Probability of Accurate Path: The probability of needing the accurate path was found to be very low, around 0.3% for vectors of size 8, and decreases with larger vector lengths. This validates the efficiency of the fast path.

Limitations and Future Work

  • Single Hard Case: The paper identifies a single input value that requires special handling. While this is a minor issue in practice (given its rarity), it's a limitation that was addressed with a specific test.
  • Architecture Specialization: The authors note that while their code is portable C, specializing it for particular architectures could yield even greater performance gains.
  • Broader Function Set: The success with the exponential function opens the door for extending this approach to other elementary functions, paving the way for a more complete set of correctly rounded vectorized mathematical operations.
  • IEEE-754 Inclusion: The authors suggest that this work could pave the way for including correctly rounded vectorized elementary functions in future IEEE-754 standards.

Summary updated

Abstract

We present a vectorized implementation of the exponential function that is correctly rounded in rounded-to-nearest binary64 floating-point arithmetic, demonstrating the feasibility of vectorized correctly rounded implementations. The vectorization is done automatically by the compiler.
BibTeX
@inproceedings{brisebarre2026correctly,
  author = {Nicolas Brisebarre and Tom Hubrecht and Christoph Lauter and Jean-Michel Muller and Kristalys Ruiz-Rohena},
  title = {{Correctly rounded vector implementation of the exponential function in binary64 arithmetic}},
  booktitle = {SPIRE},
  year = {2026},
}

Loading related content...

Figure