Skip to main content

function

fma

fma(a: Int, b: Int, c: Int) -> Int

Performs fma (fused multiply-add) on the inputs.

The result is (a * b) + c.

Args:

  • a (Int): The first input.
  • b (Int): The second input.
  • c (Int): The third input.

Returns:

(a * b) + c.

fma[type: DType, simd_width: Int](a: SIMD[type, simd_width], b: SIMD[type, simd_width], c: SIMD[type, simd_width]) -> SIMD[$0, $1]

Performs elementwise fma (fused multiply-add) on the inputs.

Each element in the result SIMD vector is (AiBi)+Ci(A_i * B_i) + C_i, where AiA_i, BiB_i and CiC_i are elements at index ii in a, b, and c respectively.

Parameters:

  • type (DType): The dtype of the input SIMD vector.
  • simd_width (Int): The width of the input and output SIMD vector.

Args:

  • a (SIMD[type, simd_width]): The first vector of inputs.
  • b (SIMD[type, simd_width]): The second vector of inputs.
  • c (SIMD[type, simd_width]): The third vector of inputs.

Returns:

Elementwise fma of a, b and c.