This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++20 status.

### 3201. `lerp` should be marked as `noexcept`

Section: 28.7.4 [c.math.lerp] Status: C++20 Submitter: Paolo Torres Opened: 2019-04-10 Last modified: 2021-02-25

Priority: 2

View all issues with C++20 status.

Discussion:

The overloads of `lerp` should be marked as `noexcept`, and this can be explained through the Lakos Rule. This function does not specify any undefined behaviour, and as such has no preconditions. This implies it has a wide contract, meaning it cannot throw, and thus can be marked as `noexcept`.

[2020-02 Moved to Immediate on Thursday afternoon in Prague.]

Proposed resolution:

This wording is relative to N4810.

1. Modify 28.7.1 [cmath.syn], header `<cmath>` synopsis, as indicated:

   >     // 28.7.4 [c.math.lerp], linear interpolation
   >     constexpr float lerp(float a, float b, float t) noexcept;
   >     constexpr double lerp(double a, double b, double t) noexcept;
   >     constexpr long double lerp(long double a, long double b, long double t) noexcept;

2. Modify 28.7.4 [c.math.lerp] as indicated:

   >     constexpr float lerp(float a, float b, float t) noexcept;
   >     constexpr double lerp(double a, double b, double t) noexcept;
   >     constexpr long double lerp(long double a, long double b, long double t) noexcept;