---
title: "f64(): IR builder function in typeshade/core/ir, TypeShade"
description: "f64, an IR builder function in typeshade/core/ir. An f64 literal node."
url: https://typeshade.dev/api/f64/
language: en
---

# `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()`](https://typeshade.dev/reference/functions/f64/)

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

## Syntax

```ts
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`](https://typeshade.dev/reference/errors/sd0116/)**

[`SD0116`](https://typeshade.dev/reference/errors/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`](https://typeshade.dev/api/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

```ts
import { f64 } from 'typeshade/core/ir'

const radius = f64(6378137)  // Node<'f64'>
```

## Targets

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

- [Values and mutation](https://typeshade.dev/guide/internals/values-and-mutation/)
- [The CPU oracle](https://typeshade.dev/guide/internals/the-cpu-oracle/)
- [fp64](https://typeshade.dev/guide/internals/fp64/)

## See also

- [`f64()`](https://typeshade.dev/reference/functions/f64/)
- [`toF64`](https://typeshade.dev/api/tof64/)

## Source

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