div
이 페이지에서

div()

함수, 내장 함수 분류

a / b as a free function, for a literal numerator: div(1, x) is the reciprocal, and emits (1.0 / x).

import { div } from 'typeshade'

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

구문

function div<E extends string, N extends number>(
a: ReadonlyNode<E>,
b: ReadonlyNode<`vec${N}<${E}>`>,
): Node<`vec${N}<${E}>`>;
function div<K extends string>(a: ReadonlyNode<K>, b: ArithArg<K>): Node<K>;
function div<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, div, f32T } from 'typeshade'
const recip = fn('recip', { x: f32T }, ({ x }) => div(1, x))

관련 가이드

함께 보기

소스

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

이 페이지 편집 문제 보고