mp_units::fma¶
fma overloads
Synopses¶
Declared in <mp-units/math.h>
Computes the fma of 3 quantities
template<auto R, auto S, auto T, typename Rep1, typename Rep2, typename Rep3>
requires detail::QuantitySpecsOfTheSameKind<get_quantity_spec(R) * get_quantity_spec(S),
get_quantity_spec(T)> &&
(mp_units::utility::equivalent(get_unit(R) * get_unit(S), get_unit(T))) &&
requires(Rep1 v1, Rep2 v2, Rep3 v3) {
requires requires { fma(v1, v2, v3); }
#if MP_UNITS_HOSTED
|| requires { std::fma(v1, v2, v3); }
#endif
;
}
[[nodiscard]] constexpr QuantityOf<
decltype(std::declval<quantity<R, std::common_type_t<Rep1, Rep2, Rep3>>>() *
std::declval<quantity<S, std::common_type_t<Rep1, Rep2, Rep3>>>() +
std::declval<
quantity<T, std::common_type_t<Rep1, Rep2, Rep3>>>())::quantity_spec> auto
fma(quantity<R, Rep1> const& a, quantity<S, Rep2> const& x,
quantity<T, Rep3> const& b) noexcept;
Computes the fma of 2 quantities and a quantity point
template<auto R, auto S, auto T, auto Origin, typename Rep1, typename Rep2, typename Rep3>
requires detail::QuantitySpecsOfTheSameKind<get_quantity_spec(R) * get_quantity_spec(S),
get_quantity_spec(T)> &&
(mp_units::utility::equivalent(get_unit(R) * get_unit(S), get_unit(T))) &&
requires(Rep1 v1, Rep2 v2, Rep3 v3) {
requires requires { fma(v1, v2, v3); }
#if MP_UNITS_HOSTED
|| requires { std::fma(v1, v2, v3); }
#endif
;
}
[[nodiscard]] constexpr QuantityPointOf<
decltype(std::declval<quantity<R, std::common_type_t<Rep1, Rep2, Rep3>>>() *
std::declval<quantity<S, std::common_type_t<Rep1, Rep2, Rep3>>>() +
std::declval<quantity_point<
T, Origin, std::common_type_t<Rep1, Rep2, Rep3>>>())::quantity_spec> auto
fma(quantity<R, Rep1> const& a, quantity<S, Rep2> const& x,
quantity_point<T, Origin, Rep3> const& b) noexcept;
Return Value¶
- Quantity: The nearest floating point representable to ax+b
- QuantityPoint: The nearest floating point representable to ax+b
Note
The return value should not be discarded.
Parameters¶
| Name | Description |
|---|---|
| a | Multiplicand |
| x | Multiplicand |
| b | Addend |