IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).

Mojo function

remove_neg_zero

def remove_neg_zero[dtype: DType, width: Int](v: SIMD[dtype, width]) -> SIMD[dtype, width]

Maps every -0.0 lane to +0.0, leaving all other lanes bit-identical.

This is the producer-sanitize step: after it, real data can never be mistaken for the readiness sentinel. Lanes holding +0.0, NaN, Inf, or any normal value are returned bit-for-bit unchanged. The implementation is branchless: bitcast to the unsigned lane type, select the sentinel lanes to +0.0 bits (all zero), and bitcast back.

Parameters:

  • โ€‹dtype (DType): The transport float type. Must be bfloat16, float16, or float32.
  • โ€‹width (Int): The SIMD pack width.

Args:

Returns:

SIMD[dtype, width]: v with any -0.0 lane replaced by +0.0.