toF32()
Function in Builtins
Convert to f32. On an f64 argument this is the explicit, precision-losing narrow, computed as the sum of the hi and lo halves; f64 never narrows implicitly.
import { toF32 } from 'typeshade'
The signature, the description and the examples come from the compiler's own source at commit 26de7be8.
Syntax
const toF32: (x: ReadonlyNode<string> | number) => Node<"f32">Parameters
xReadonlyNode<string> | number
Return value
Node<'f32'>
Description
Emits f32(x) on WGSL and
float(x) on GLSL.
Targets
| Target | Support | Notes |
|---|---|---|
| WGSL (WebGPU) | Supported |
|
| GLSL ES 3.00 (WebGL2) | Supported |
|
| CPU oracle | Supported | Evaluated in f64 by the oracle. |
In the guide
Source
src/core/ir/node.ts, line 2376, at commit 26de7be8