--- layout: stdlib-reference --- # fma ## Description Fused multiply-add. ## Signature
/// Requires Capability Set 1:
T fma<T>(
    T a,
    T b,
    T c)
    where T : __BuiltinFloatingPointType;

/// Requires Capability Set 1:
vector<T, N> fma<T, int N>(
    vector<T, N> a,
    vector<T, N> b,
    vector<T, N> c)
    where T : __BuiltinFloatingPointType;

/// Requires Capability Set 1:
matrix<T, N, M> fma<T, int N, int M>(
    matrix<T, N, M> a,
    matrix<T, N, M> b,
    matrix<T, N, M> c)
    where T : __BuiltinFloatingPointType;

/// Requires Capability Set 2:
CoopVec<T, N> fma<T, int N>(
    CoopVec<T, N> a,
    CoopVec<T, N> b,
    CoopVec<T, N> c)
    where T : __BuiltinFloatingPointType;

## Generic Parameters #### T: [\_\_BuiltinFloatingPointType](../interfaces/0_builtinfloatingpointtype-029hm/index.html) #### N : int #### M : int ## Parameters #### a : [T](fma.html#typeparam-T) The first value to multiply. #### b : [T](fma.html#typeparam-T) The second value to multiply. #### c : [T](fma.html#typeparam-T) The value to add to the product of a and b. #### a : [vector](../types/vector/index.html)\<[T](../types/vector/index.html#typeparam-T), [N](../types/vector/index.html#decl-N)\> The first value to multiply. #### b : [vector](../types/vector/index.html)\<[T](../types/vector/index.html#typeparam-T), [N](../types/vector/index.html#decl-N)\> The second value to multiply. #### c : [vector](../types/vector/index.html)\<[T](../types/vector/index.html#typeparam-T), [N](../types/vector/index.html#decl-N)\> The value to add to the product of a and b. #### a : [matrix](../types/matrix/index.html)\<[T](../types/matrix/t-0.html), [N](../types/matrix/index.html#decl-N), [M](../types/matrix/index.html#decl-M)\> The first value to multiply. #### b : [matrix](../types/matrix/index.html)\<[T](../types/matrix/t-0.html), [N](../types/matrix/index.html#decl-N), [M](../types/matrix/index.html#decl-M)\> The second value to multiply. #### c : [matrix](../types/matrix/index.html)\<[T](../types/matrix/t-0.html), [N](../types/matrix/index.html#decl-N), [M](../types/matrix/index.html#decl-M)\> The value to add to the product of a and b. #### a : [CoopVec](../types/coopvec-04/index.html)\<[T](../types/coopvec-04/index.html#typeparam-T), [N](../types/coopvec-04/index.html#decl-N)\> The first value to multiply. #### b : [CoopVec](../types/coopvec-04/index.html)\<[T](../types/coopvec-04/index.html#typeparam-T), [N](../types/coopvec-04/index.html#decl-N)\> The second value to multiply. #### c : [CoopVec](../types/coopvec-04/index.html)\<[T](../types/coopvec-04/index.html#typeparam-T), [N](../types/coopvec-04/index.html#decl-N)\> The value to add to the product of a and b. ## Return value The result of a*b+c. ## Availability and Requirements ### Capability Set 1 Defined for the following targets: #### hlsl Available in all stages. #### glsl Available in all stages. #### cpp Available in all stages. #### cuda Available in all stages. #### metal Available in all stages. #### wgsl Available in all stages. #### spirv Available in all stages. ### Capability Set 2 Defined for the following targets: #### hlsl Available in all stages. Requires capability: `hlsl_coopvec_poc`. #### cpp Available in all stages. #### cuda Available in all stages. Requires capability: `optix_coopvec`. #### spirv Available in all stages. Requires capability: `spvCooperativeVectorNV`.