toF32
On this page

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

x ReadonlyNode<string> | number

Return value

Node<'f32'>

Description

Emits f32(x) on WGSL and float(x) on GLSL.

Targets

TargetSupportNotes
WGSL (WebGPU) Supported

f32(x).

GLSL ES 3.00 (WebGL2) Supported

float(x).

CPU oracle Supported

Evaluated in f64 by the oracle.

In the guide

Source

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

Edit this page Report a problem