isF64
On this page

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

t ShaderType

Return value

t is Extract<ShaderType, { kind: 'f64' }>

Exceptions

SD0004

Mixing f64 with an i32, u32 or bool operand throws SD0004, since emulated double precision only widens from f32 and 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) // true
isF64(f32T) // false

See also

Source

src/core/ir/types/predicates.ts, line 83, at commit af54ddad5

Edit this page Report a problem