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

Created on 2019-04-10.00:00:00 last changed 45 months ago

Messages

Date: 2020-02-14.06:55:06

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: 2020-02-14.06:55:06

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

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
2021-02-25 10:48:01adminsetstatus: wp -> c++20
2020-02-24 16:02:59adminsetstatus: immediate -> wp
2020-02-14 06:55:06adminsetmessages: + msg11091
2020-02-14 06:55:06adminsetstatus: new -> immediate
2019-04-13 16:51:49adminsetmessages: + msg10393
2019-04-10 00:00:00admincreate