bitcastF32
On this page

bitcastF32()

Function in Builtins

Reinterpret the bit pattern of a u32 as an f32, the inverse of bitcastU32.

import { bitcastF32 } from 'typeshade'

The signature, the description and the examples come from the compiler's own source at commit 26de7be8.

Syntax

const bitcastF32: (v: ReadonlyNode<"u32">) => Node<"f32">

Parameters

v ReadonlyNode<'u32'>

Return value

Node<'f32'>

Description

Emitted as bitcast<f32>(x) on WGSL and uintBitsToFloat(x) on GLSL. An f32 to u32 to f32 round-trip is a fast-math optimization barrier, since the integer domain is not subject to float reassociation or contraction; optBarrier packages that.

Targets

TargetSupportNotes
WGSL (WebGPU) Supported

bitcast<f32>(v).

GLSL ES 3.00 (WebGL2) Supported

uintBitsToFloat(v).

CPU oracle Supported

Evaluated in f64 by the oracle.

See also

Source

src/core/ir/node.ts, line 1930, at commit 26de7be8

Edit this page Report a problem