Skip to content

createIeeeBinaryWasmKernel

createIeeeBinaryWasmKernel(): Promise<Ieee754Kernel<Uint32Array<ArrayBufferLike>>>

Defined in: packages/math-numbers/src/ieee754/binary/kernels/wasm/wasm-kernel.ts:79

Adapts an instantiated soft_float.wasm module to a Ieee754Kernel.

The caller instantiates the module — the mechanism and its timing are the caller’s business — and installs the result with installSoftFloatKernel. Nothing here is asynchronous, so arithmetic never awaits.

The WASM engine works on packed IEEE 754 bit patterns using native i32 and i64 operations, which is where its advantage over the bigint-based JS kernel comes from. Operands already carrying this kernel’s own limb-encoded significand (see sig-convert.ts) cost nothing extra at this boundary; anything else (a plain bigint-backed value) is converted once here, so the accelerator pays for its own representation rather than the default path paying for one it does not use.

Promise<Ieee754Kernel<Uint32Array<ArrayBufferLike>>>

A kernel ready to install.

const { instance } = await WebAssembly.instantiate(await readFile(path));
installSoftFloatKernel(
createWasmSoftFloatKernel(instance.exports as SoftFloatWasmExports),
);
```;