min()
함수, 내장 함수 분류
min(a, b): component-wise minimum.
import { min } from 'typeshade'
시그니처, 설명, 예제는 커밋 c66579bf의 컴파일러 소스에서 그대로 가져온 영어 원문입니다.
구문
const min: <K extends FloatKey | Float64Key | IntKey>( a: ReadonlyNode<K>, b: NoInfer<ArithArg<K>>,) => Node<K>매개변수
aReadonlyNode<K>bNoInfer<ArithArg<K>>
반환값
Node<K>
설명
b may be a scalar broadcast against a vector a,
the same rule as the arithmetic methods, so min(color, 1) caps every channel against one
literal without unrolling per component.
예제
예제
import { fn, min, f32T } from 'typeshade'
const capped = fn('capped', { x: f32T }, ({ x }) => min(x, 1))대상별 지원
| 대상 | 지원 | 비고 |
|---|---|---|
| WGSL (WebGPU) | 지원 |
|
| GLSL ES 3.00 (WebGL2) | 지원 |
|
| CPU 오라클 | 지원 | Evaluated in f64 by the oracle. |
관련 가이드
소스
src/core/ir/node.ts, 1633행, 커밋 c66579bf 기준