interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / gpu / nvidia / om / numeric / no_bf16.om

14 lines · 461 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note Integer-only freestanding binary32 to bf16 RNE; preserve quiet NaN payload.
3note WolframLanguageEvaluator: FromDigits[#,16]& /@ {"7f800000","007fffff","0040","7fff"}
4note -> {2139095040,8388607,64,32767}.
5fn no_bf16 raw ulong to ulong
6u = uint raw
7if eq and u 2139095040 2139095040
8if ne and u 8388607 0
9ret ulong or shr u 16 64
10end
11end
12u = add add u 32767 and shr u 16 1
13ret ulong shr u 16
14end