isF64
On this page

isF64()

Function in Types

Narrows a ShaderType to the emulated-double scalar arm (f64T).

import { isF64 } from 'typeshade'

The signature, the description and the examples come from the compiler's own source at commit 26de7be8.

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, f64T, f32T } from 'typeshade'
isF64(f64T) // true
isF64(f32T) // false

See also

Source

src/core/ir/types.ts, line 1131, at commit 26de7be8

Edit this page Report a problem