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:
- โv (
SIMD[dtype, width]): The pack to sanitize.
Returns:
SIMD[dtype, width]: v with any -0.0 lane replaced by +0.0.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!