---
title: "CpuValue: type in CPU oracle, TypeShade API reference"
description: "CpuValue, a type in CPU oracle. A value as the CPU backends (compileModule and compileModuleJs) represent it: a plain JavaScript value…"
url: https://typeshade.dev/api/cpuvalue/
language: en
---

# `CpuValue`

Type in CPU oracle

A value as the CPU backends (compileModule and compileModuleJs) represent it: a plain JavaScript value, never a typed array or a GPU buffer.

`import type { CpuValue } from 'typeshade'`

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

## Syntax

```ts
type CpuValue = number | boolean | number[] | boolean[] | CpuStruct;
```

## Description

A scalar of any kind (`f32`, `f64`, `i32`, `u32`, bool) is a `number` or `boolean`, computed in double precision; [`CpuPrecision`](https://typeshade.dev/api/cpuprecision/) says how the arithmetic rounds. A vector or matrix is a flat `number[]`, mutable and shared by reference: a field write such as `p.x = …` inside a shader function changes the caller’s array in place. A struct is a [`CpuStruct`](https://typeshade.dev/api/cpustruct/). This is the value type the functions of a [`CpuModule`](https://typeshade.dev/api/cpumodule/) take and return, and the one its `setBinding` accepts.

## See also

- [`compileModule`](https://typeshade.dev/api/compilemodule/)
- [`compileModuleJs`](https://typeshade.dev/api/compilemodulejs/)
- [`CpuPrecision`](https://typeshade.dev/api/cpuprecision/)
- [`CpuStruct`](https://typeshade.dev/api/cpustruct/)
- [`CpuModule`](https://typeshade.dev/api/cpumodule/)

## Source

[`src/core/cpu-runtime/values.ts`, line 15](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/cpu-runtime/values.ts#L15), at commit af54ddad5
