mul()
Function in Builtins
a * b as a free function, for a literal left operand: mul(2, x) emits (2.0 * x).
import { mul } from 'typeshade/core/ir'
The signature, the description and the examples come from the compiler's own source at commit af54ddad5.
Syntax
function mul<E extends string, N extends number>( a: ReadonlyNode<E>, b: ReadonlyNode<`vec${N}<${E}>`>,): Node<`vec${N}<${E}>`>;function mul<K extends string>(a: ReadonlyNode<K>, b: ArithArg<K>): Node<K>;function mul<K extends string>(a: number, b: ReadonlyNode<K>): Node<K>;Parameters
aReadonlyNode<E>bReadonlyNode<`vec${N}<${E}>`>
Return value
Node<`vec${N}<${E}>`>
Exceptions
TypeErrorboth operands are plain numbers.
Description
Whichever operand is a node types the other. Two bare numbers are rejected.
Examples
Example
import { fn, mul, f32T } from 'typeshade/core/ir'
const doubled = fn('doubled', { x: f32T }, ({ x }) => mul(2, x))See also
Source
src/core/ir/node.ts, line 1013, at commit af54ddad5