---
title: "bitcastF32(): IR builder function in typeshade/core/ir"
description: "bitcastF32, an IR builder function in typeshade/core/ir. Reinterpret the bit pattern of a u32 as an f32, the inverse of bitcastU32."
url: https://typeshade.dev/api/bitcastf32/
language: en
---

# `bitcastF32()`

Function in Builtins

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

`import { bitcastF32 } from 'typeshade/core/ir'`

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

## Syntax

```ts
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`](https://typeshade.dev/api/optbarrier/) packages that.

## Targets

| Target | Support | Notes |
| --- | --- | --- |
| 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

- [`bitcastU32`](https://typeshade.dev/api/bitcastu32/)
- [`optBarrier`](https://typeshade.dev/api/optbarrier/)

## Source

[`src/core/ir/node.ts`, line 1687](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/ir/node.ts#L1687), at commit af54ddad5
