---
title: "madd(): IR builder function in typeshade/core/ir, TypeShade"
description: "madd, an IR builder function in typeshade/core/ir. Multiply-add, a*b + c, written as the plain a.mul(b).add(c) chain."
url: https://typeshade.dev/api/madd/
language: en
---

# `madd()`

Function in Builtins

Multiply-add, a\*b + c, written as the plain a.mul(b).add(c) chain.

`import { madd } from 'typeshade/core/ir'`

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

## Syntax

```ts
const madd: <K extends string>(
  a: ReadonlyNode<K>,
  b: NoInfer<ArithArg<K>>,
  c: NoInfer<ArithArg<K>>,
) => Node<K>
```

## Parameters

**`a` `ReadonlyNode<K>`**

**`b` `NoInfer<ArithArg<K>>`**

**`c` `NoInfer<ArithArg<K>>`**

## Return value

`Node<K>`

## Description

To emit WGSL’s multiply-add builtin use [`fma`](https://typeshade.dev/api/fma/); neither form guarantees a single rounding.

## See also

- [`fma`](https://typeshade.dev/api/fma/)

## Source

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