IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /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. /get-started.md).

Mojo function

mhc_fn_split

def mhc_fn_split[width: SIMDLength](v: SIMD[.float32, width]) -> Tuple[SIMD[.bfloat16, width], SIMD[.bfloat16, width], SIMD[.bfloat16, width]]

Splits fp32 values into three bf16 terms whose sum is exactly v.

Each round-to-nearest step keeps 8 significant bits and leaves a remainder at most half an ulp of the term, so the second remainder has at most 8 significant bits and the third term is exact (for normal v within the bfloat16 range; larger finite v rounds hi to inf).

Parameters:

Args:

Returns:

Tuple[SIMD[.bfloat16, width], SIMD[.bfloat16, width], SIMD[.bfloat16, width]]: The (hi, lo, lo2) terms, in decreasing magnitude.

Was this page helpful?