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'
The signature, the description and the examples come from the compiler's own source at commit 26de7be8.
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'
const doubled = fn('doubled', { x: f32T }, ({ x }) => mul(2, x))In the guide
See also
Source
src/core/ir/node.ts, line 1225, at commit 26de7be8