Skip to main content
Log in

Mojo 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.

Constraints:

The type of the input must be numeric.

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.

Was this page helpful?