Title
lerp should be marked as noexcept
Status
new
Section
[c.math.lerp]
Submitter
Paolo Torres

Created on 2019-04-10.00:00:00, last changed 2019-04-13.16:51:49.

Messages

Date: 2019-04-13.16:51:49

Proposed resolution:

This wording is relative to N4810.

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

    // [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 [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;
    
Date: 2019-04-10.00:00:00

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.

History
Date User Action Args
2019-04-13 16:51:49adminsetmessages: + msg10393
2019-04-10 00:00:00admincreate