f64
On this page

f64()

Function in Values

An f64 literal node.

import { f64 } from 'typeshade'

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

Syntax

function f64(v: number): Node<'f64'>;
function f64(x: ReadonlyNode<'f32'>): Node<'f64'>;

Parameters

v number

Return value

Node<'f64'>

Exceptions

TypeError

v is neither a JS number nor an f32 node.

SD0116

SD0116 when the node operand is not a scalar.

Description

The literal carries the full JS double value and is split into its (hi, lo) f32 halves when the module is built, so the authored constant round-trips without loss.

An f32 Node argument is a cast instead — the exact widening toF64 performs, and the free-function twin of x.f64(). Bounded to f32 for the reason toF64 is: no other scalar has an exact widening the fp64 lowering implements.

Examples

Example

import { f64 } from 'typeshade'
const radius = f64(6378137) // Node<'f64'>

Targets

TargetSupportNotes
WGSL (WebGPU) Emulated

Rewritten by fp64Lower into a pair of f32 lanes before the backend runs.

GLSL ES 3.00 (WebGL2) Emulated

Rewritten by fp64Lower into a pair of f32 lanes before the backend runs.

CPU oracle Supported

Evaluated in f64 by the oracle.

In the guide

See also

Source

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

Edit this page Report a problem