[#mp_units-lerp] = xref:mp_units.adoc[mp_units]::lerp :relfileprefix: ../ :mrdocs: Linear interpolation or extrapolation == Synopsis Declared in `<mp‐units/math.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< auto R1, auto Origin, typename Rep1, auto R2, typename Rep2, typename Factor> requires requires(Rep1 a, Rep2 b, Factor t) { get_common_reference(R1, R2); requires requires { lerp(a, b, t); } || requires { std::lerp(a, b, t); }; } [[nodiscard]] constexpr xref:mp_units/QuantityPointOf.adoc[QuantityPointOf<get_quantity_spec(get_common_reference(R1, R2))>] auto lerp( xref:mp_units/quantity_point-08.adoc[quantity_point<R1, Origin, Rep1>] const& a, xref:mp_units/quantity_point-08.adoc[quantity_point<R2, Origin, Rep2>] const& b, Factor const& t) noexcept; ---- == Description Computes the linear interpolation between `a` and `b`, if the parameter `t` is inside `[​0​, 1)` (the linear extrapolation otherwise), i.e. the result of `a + t(b − a)` with accounting for floating‐point calculation imprecision. == Parameters [cols=2] |=== | Name | Description | *a* | A quantity point | *b* | A quantity point |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#