mul
이 페이지에서

mul()

함수, 내장 함수 분류

a * b as a free function, for a literal left operand: mul(2, x) emits (2.0 * x).

import { mul } from 'typeshade'

시그니처, 설명, 예제는 커밋 c66579bf의 컴파일러 소스에서 그대로 가져온 영어 원문입니다.

구문

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>;

매개변수

a ReadonlyNode<E>
b ReadonlyNode<`vec${N}<${E}>`>

반환값

Node<`vec${N}<${E}>`>

예외

TypeError

both operands are plain numbers.

설명

Whichever operand is a node types the other. Two bare numbers are rejected.

예제

예제

import { fn, mul, f32T } from 'typeshade'
const doubled = fn('doubled', { x: f32T }, ({ x }) => mul(2, x))

관련 가이드

함께 보기

소스

src/core/ir/node.ts, 1225행, 커밋 c66579bf 기준

이 페이지 편집 문제 보고