max
이 페이지에서

max()

함수, 내장 함수 분류

max(a, b): component-wise maximum, the partner of min(/api/min/).

import { max } from 'typeshade'

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

구문

const max: <K extends FloatKey | Float64Key | IntKey>(
a: ReadonlyNode<K>,
b: NoInfer<ArithArg<K>>,
) => Node<K>

매개변수

a ReadonlyNode<K>
b NoInfer<ArithArg<K>>

반환값

Node<K>

설명

b may be a scalar broadcast against a vector a. A common floor idiom is max(x, f32(1e-6)), which keeps a divisor or a sqrt or log argument off zero without a branch.

예제

예제

import { fn, max, f32, f32T } from 'typeshade'
const safe = fn('safe', { x: f32T }, ({ x }) => max(x, f32(1e-6)))

대상별 지원

대상지원비고
WGSL (WebGPU) 지원

max(a, b). Over f64 operands the fp64 pass rewrites it into its df64 helper.

GLSL ES 3.00 (WebGL2) 지원

max(a, b). Over f64 operands the fp64 pass rewrites it into its df64 helper.

CPU 오라클 지원

Evaluated in f64 by the oracle.

관련 가이드

함께 보기

소스

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

이 페이지 편집 문제 보고