pow()
함수, 내장 함수 분류
pow(a, b): a raised to the power b, component-wise.
import { pow } from 'typeshade'
시그니처, 설명, 예제는 커밋 c66579bf의 컴파일러 소스에서 그대로 가져온 영어 원문입니다.
구문
function pow<K extends FloatKey>(a: ReadonlyNode<K>, b: NoInfer<ArithArg<K>>): Node<K>;function pow(a: number, b: ReadonlyNode<'f32'>): Node<'f32'>;매개변수
aReadonlyNode<K>bNoInfer<ArithArg<K>>
반환값
Node<K>
설명
A JS number b lifts to the
kind of a, so pow(z, 4) emits pow(z, 4.0) for an f32 base. WGSL requires a and b
to have the same type, so a vector a needs a vector b; a scalar b against a vector
a passes the type check here and is rejected by the WGSL compiler.
대상별 지원
| 대상 | 지원 | 비고 |
|---|---|---|
| WGSL (WebGPU) | 지원 |
|
| GLSL ES 3.00 (WebGL2) | 지원 |
|
| CPU 오라클 | 지원 | Evaluated in f64 by the oracle. |
관련 가이드
소스
src/core/ir/node.ts, 1658행, 커밋 c66579bf 기준