Skip to main content

Mojo function

ldexp

ldexp[dtype: DType, width: Int, //](x: SIMD[dtype, width], exp: SIMD[int32, width]) -> SIMD[dtype, width]

Computes elementwise ldexp function.

The ldexp function multiplies a floating point value x by the number 2 raised to the exp power. I.e. ldexp(x,exp)ldexp(x,exp) calculate the value of x2expx * 2^{exp} and is used within the erferf function.

Parameters:

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

Args:

  • x (SIMD[dtype, width]): SIMD vector of floating point values.
  • exp (SIMD[int32, width]): SIMD vector containing the exponents.

Returns:

Vector containing elementwise result of ldexp on x and exp.

Was this page helpful?