Skip to main content
Log in

Mojo function

frexp

frexp[type: DType, simd_width: Int, //](x: SIMD[type, simd_width]) -> StaticTuple[SIMD[type, simd_width], 2]

Breaks floating point values into a fractional part and an exponent part. This follows C and Python in increasing the exponent by 1 and normalizing the fraction from 0.5 to 1.0 instead of 1.0 to 2.0.

Constraints:

The input must be a floating-point type.

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:

  • x (SIMD[type, simd_width]): The input values.

Returns:

A tuple of two SIMD vectors containing the fractional and exponent parts of the input floating point values.