Skip to main content



assert_almost_equal[type: DType, size: Int](lhs: SIMD[type, size], rhs: SIMD[type, size], /, *, msg: String = "", atol: SIMD[type, 1] = #kgen.float_literal<1|100000000>, rtol: SIMD[type, 1] = #kgen.float_literal<1|100000>, equal_nan: Bool = false)

Asserts that the input values are equal up to a tolerance. If it is not then an Error is raised.


  • type (DType): The dtype of the left- and right-hand-side SIMD vectors.
  • size (Int): The width of the left- and right-hand-side SIMD vectors.


  • lhs (SIMD[type, size]): The lhs of the equality.
  • rhs (SIMD[type, size]): The rhs of the equality.
  • msg (String): The message to print.
  • atol (SIMD[type, 1]): The _absolute tolerance.
  • rtol (SIMD[type, 1]): The relative tolerance.
  • equal_nan (Bool): Whether to treat nans as equal.


An Error with the provided message if assert fails and None otherwise.