diff --git a/src/webgpu/util/math.ts b/src/webgpu/util/math.ts index 018d350a984d..9b901bfa6da4 100644 --- a/src/webgpu/util/math.ts +++ b/src/webgpu/util/math.ts @@ -2013,13 +2013,9 @@ export interface QuantizeFunc { (num: number): number; } -/** Statically allocate working data, so it doesn't need per-call creation */ -const quantizeToF32Data = new Float32Array(new ArrayBuffer(4)); - /** @returns the closest 32-bit floating point value to the input */ export function quantizeToF32(num: number): number { - quantizeToF32Data[0] = num; - return quantizeToF32Data[0]; + return Math.fround(num); } /** @returns the closest 16-bit floating point value to the input */