This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.
Section: 29.7.4 [c.math.lerp] Status: New Submitter: Jan Schultke Opened: 2026-07-01 Last modified: 2026-07-04
Priority: Not Prioritized
View all other issues in [c.math.lerp].
View all issues with New status.
Discussion:
Consider the following example, which (mathematically) attempts to compute .
#include <cmath> #include <limits> constexpr float inf = std::numeric_limits<float>::infinity(); constexpr float x = std::lerp(inf, inf, 0.f);
MSVC accepts this, but GCC and Clang reject it due to floating-point arithmetic that produces a NaN,
within the implementation of std::lerp.
std::lerp because
it is not a C standard library function. Since this means there exists no specification of when std::lerp
raises which floating-point exceptions, all calls to std::lerp are constant expressions (?), which is
inconsistent with the other functions in <cmath>.
Similarly, the three-dimensional hypotenuse function is missing a specification of when any errors would
occur, which is addressed only partially by LWG 3172(i) by saying that a "range error may occur"
without any specification of when exactly that would happen or when a domain error occurs.
A possible direction is to ensure that C23 ยง7.21.1 Treatment of error conditions
applies to three-dimension std::hypot and std::lerp as well, despite those not being C standard library
functions.
Proposed resolution: