Skip to main content

Mojo function

copysign

copysign[dtype: DType, width: Int, //](magnitude: SIMD[dtype, width], sign: SIMD[dtype, width]) -> SIMD[dtype, width]

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

Constraints:

The type of the input must be numeric.

Parameters:

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

Args:

  • magnitude (SIMD[dtype, width]): The magnitude to use.
  • sign (SIMD[dtype, width]): The sign to copy.

Returns:

Copies the sign from sign to magnitude.

Was this page helpful?