Open geyang opened 1 year ago
That is a correct behavior since Float16Array
proxies Uint16Array
by design.
Some JavaScript runtimes can handle the output of console.log
, so try custom inspections.
Node.js (Bun):
import { Float16Array } from "@petamoriken/float16";
import { customInspect } from "@petamoriken/float16/inspect";
Float16Array.prototype[Symbol.for("nodejs.util.inspect.custom")] = customInspect;
Deno:
import { Float16Array } from "https://deno.land/x/float16/mod.ts";
import { customInspect } from "https://deno.land/x/float16/inspect.ts";
// deno-lint-ignore no-explicit-any
(Float16Array.prototype as any)[Symbol.for("Deno.customInspect")] = customInspect;
Thanks for this fantastic library!
from the example, the expected output of the following map should be:
Expected Output
Actual Output (wrong)
This, however, works:
Outputs: (correct)