f64()
Function in Values
An f64 literal node.
import { f64 } from 'typeshade/core/ir'
This export returns an IR node. A "use typeshade" file calls the builtin itself: f64()
The signature, the description and the examples come from the compiler's own source at commit af54ddad5.
Syntax
function f64(v: number): Node<'f64'>;function f64(x: ReadonlyNode<'f32'>): Node<'f64'>;Parameters
vnumber
Return value
Node<'f64'>
Exceptions
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/core/ir'
const radius = f64(6378137) // Node<'f64'>Targets
| Target | Support | Notes |
|---|---|---|
| WGSL (WebGPU) | Emulated | Rewritten by |
| GLSL ES 3.00 (WebGL2) | Emulated | Rewritten by |
| CPU oracle | Supported | Evaluated in |
In the guide
See also
Source
src/core/ir/node.ts, line 857, at commit af54ddad5