---
title: "SD0041: unsupported operation on f64 operands in TypeShade"
description: "SD0041, an error code of the TypeShade compiler. unsupported operation on f64 operands"
url: https://typeshade.dev/reference/errors/sd0041/
language: en
---

# `SD0041`

Core code

unsupported operation on `f64` operands

The registry text and every compiler message on these pages are the compiler's own English.

## In the front end

A `"use typeshade"` file never reaches this check with the same mistake: the front end refuses it first, under its own code. This program, compiled at build time, gets:

example.shade.ts

```ts
"use typeshade"

class Uniforms {
  m: mat3<f64>
}

declare const u: uniform<Uniforms>

@fragment
export function main(uv: location<0, vec2>): vec4 {
  const k = u.m + u.m
  return vec4(uv, 0., 1.)
}
```

**[TS8003](https://typeshade.dev/reference/errors/ts8003/)** error, line 11: Cannot + `mat3x3<f64>`: the fp64 pass lowers only \* and transpose on a matrix of doubles. Declare the matrix `mat3x3` where you need +.

## How to fix it

The registry's hint: only + - \* / compare, abs, min, max, sqrt, mix, floor, fract, round, sin, cos (and on vectors dot, length, distance, normalize) are emulated — narrow explicitly first: `f32`(x) on a scalar and vecN(v) on a vector in a "use typeshade" program, toF32(x) in the fn() EDSL

## See also

**[`TS8003`](https://typeshade.dev/reference/errors/ts8003/) `TYPE_MISMATCH`**

Two types that do not fit where they meet (an operator, a condition, a declaration, a return or an argument), a read of an optional value (`T | undefined`, `T | null` or `T | null | undefined`) that no test narrowed ([Rule 7.10](https://typeshade.dev/reference/rules/7-10/)), or a constant the compiler folds that WGSL refuses: a shift amount past 31, a divisor of 0, clamp bounds that cross, an `f32` past its range or a builtin call outside its domain, such as `Math.pow(-2., 2.)`.

- [Emulated double](https://typeshade.dev/guide/language/from-typescript/double/)
- [`TypeShadeError`](https://typeshade.dev/api/typeshadeerror/)
- [Error codes](https://typeshade.dev/reference/errors/)

## Source

Where the compiler raises this code at commit af54ddad5, one line per file:

- [`src/core/ir/node.ts:173`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/ir/node.ts#L173) (3 sites)
- [`src/core/passes/fp64-lower.ts:188`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/passes/fp64-lower.ts#L188)
- [`src/core/passes/fp64-lower/expr.ts:59`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/passes/fp64-lower/expr.ts#L59) (13 sites)
- [`src/core/passes/fp64-lower/mapping.ts:49`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/passes/fp64-lower/mapping.ts#L49)
- [`src/core/passes/fp64-lower/stmt.ts:23`](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/passes/fp64-lower/stmt.ts#L23) (6 sites)
