isF64()
Function in Types
Narrows a ShaderType to the emulated-double scalar arm (f64T).
import { isF64 } from 'typeshade'import { isF64 } from 'typeshade/core/ir'
The signature, the description and the examples come from the compiler's own source at commit af54ddad5.
Syntax
const isF64: (t: ShaderType) => t is Extract<ShaderType, { kind: "f64"; }>Parameters
Return value
t is Extract<ShaderType, { kind: 'f64' }>
Exceptions
SD0004Mixing
f64with ani32,u32or bool operand throws SD0004, since emulated double precision only widens fromf32and number.
Description
Arithmetic type
resolution checks it first, before native scalar promotion, so an f64 operand always wins
the result type over a plain f32 or number. Mixing f64 with an i32, u32 or bool
operand throws SD0004, since emulated double precision only widens from f32 and number.
Examples
Example
import { isF64 } from 'typeshade'import { f64T, f32T } from 'typeshade/core/ir'
isF64(f64T) // trueisF64(f32T) // falseSee also
Source
src/core/ir/types/predicates.ts, line 83, at commit af54ddad5