diff --git a/src/webgpu/util/conversion.ts b/src/webgpu/util/conversion.ts index d4cc56471bf8..ea643bc04b29 100644 --- a/src/webgpu/util/conversion.ts +++ b/src/webgpu/util/conversion.ts @@ -1,7 +1,7 @@ import { Colors } from '../../common/util/colors.js'; import { assert, TypedArrayBufferView } from '../../common/util/util.js'; -import { clamp } from './math.js'; +import { clamp, isSubnormalNumber } from './math.js'; /** * Encodes a JS `number` into a "normalized" (unorm/snorm) integer representation with `bits` bits. @@ -502,8 +502,16 @@ export class Scalar { case Infinity: case -Infinity: return Colors.bold(this.value.toString()); - default: - return Colors.bold(this.value.toString()) + ' (0x' + this.value.toString(16) + ')'; + default: { + const n = this.value as Number; + if (n !== null) { + return ( + Colors.bold(this.value.toString()) + + `(0x${this.value.toString(16)}, subnormal: ${isSubnormalNumber(n.valueOf())})` + ); + } + return Colors.bold(this.value.toString()) + `(0x${this.value.toString(16)})`; + } } } }