IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /docs/manual/basics.md). For the complete Mojo documentation index, see llms.txt.
Skip to main content
Version: 1.0.0b1
For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).

exp

exp[dtype: DType, width: Int, //](x: SIMD[dtype, width]) -> SIMD[dtype, width] where dtype.is_floating_point()

Calculates elementwise exponential of the input vector.

Given an input vector XX and an output vector YY, sets Yi=eXiY_i = e^{X_i} for each position ii in the input vector (where ee is the mathematical constant ee).

Constraints:

The input must be a floating-point type.

Parameters:

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

Args:

Returns:

SIMD[dtype, width]: A SIMD vector containing ee raised to the power XiX_i where XiX_i is an element in the input SIMD vector.

exp[T: _Expable](x: T) -> T

Computes the exponential of the input value.

Parameters:

  • T (_Expable): The type of the input value.

Args:

  • x (T): The input value.

Returns:

T: The exponential of the input value.