splitF64()
함수, f64 에뮬레이션 분류
Split a JavaScript double into the high and low f32 pair an f64T value carries on the GPU.
import { splitF64 } from 'typeshade'
시그니처, 설명, 예제는 커밋 c66579bf의 컴파일러 소스에서 그대로 가져온 영어 원문입니다.
구문
function splitF64(x: number): [hi: number, lo: number]매개변수
xnumberthe double to pack.
반환값
[hi: number, lo: number]
the [hi, lo] pair, both exactly representable as f32.
설명
hi is Math.fround(x) and lo is Math.fround(x - hi), so hi + lo
reconstructs x to about 48 significand bits.
This is the host side of the packing. An f64 uniform field or vertex attribute occupies one
plain vec2<f32> slot, size 8 and align 8, and the host writes splitF64(value) into it.
A vertex attribute cannot be a vecN<f64>. Pass a vector as two vecN<f32> locations, one
carrying every high part and one every low part, and rebuild the components in the shader
with f64FromParts.
예제
예제
import { splitF64 } from 'typeshade'
const [hi, lo] = splitF64(originLon)uniformData.set([hi, lo], offsetOfOrigin / 4)관련 가이드
함께 보기
소스
src/core/fp64/df64-lib.ts, 110행, 커밋 c66579bf 기준