Skip to content

mp_units::fma

Computes the fma of 2 quantities and a quantity point

Synopsis

Declared in <mp-units/math.h>

template<auto R, auto S, auto T, auto Origin, typename Rep1, typename Rep2, typename Rep3>
  requires requires { get_common_quantity_spec(get_quantity_spec(R) * get_quantity_spec(S), get_quantity_spec(T)); } &&
           (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<get_common_quantity_spec(get_quantity_spec(R) * get_quantity_spec(S),
                                                                 get_quantity_spec(T))> auto
fma(quantity<R, Rep1> const& a, quantity<S, Rep2> const& x, quantity_point<T, Origin, Rep3> const& b) noexcept;

Return Value

QuantityPoint: The nearest floating point representable to ax+b

Note

The return value should not be discarded.

Parameters

NameDescription
aMultiplicand
xMultiplicand
bAddend