Skip to main content

function

copysign

copysign[type: DType, simd_width: Int](magnitude: SIMD[type, simd_width], sign: SIMD[type, simd_width]) -> SIMD[$0, $1]

Returns a value with the magnitude of the first operand and the sign of the second operand.

Parameters:

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

Args:

  • magnitude (SIMD[type, simd_width]): The magnitude to use.
  • sign (SIMD[type, simd_width]): The sign to copy.

Returns:

Copies the sign from sign to magnitude.