asin
On this page

asin()

Function in Builtins

asin(x): arcsine of x, returning radians in [-π/2, π/2], component-wise.

import { asin } from 'typeshade'

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

Syntax

const asin: <K extends FloatKey>(x: ReadonlyNode<K>) => Node<K>

Parameters

x ReadonlyNode<K>

Return value

Node<K>

Description

x outside [-1, 1] is undefined per the WGSL and GLSL specs (NaN on most drivers); clamp the argument first when rounding can push it outside that range.

Examples

Example

import { fn, asin, clamp, f32T } from 'typeshade'
const angle = fn('angle', { sinA: f32T }, ({ sinA }) => asin(clamp(sinA, -1, 1)))

Targets

TargetSupportNotes
WGSL (WebGPU) Supported

asin(x).

GLSL ES 3.00 (WebGL2) Supported

asin(x).

CPU oracle Supported

Evaluated in f64 by the oracle.

See also

Source

src/core/ir/node.ts, line 1363, at commit 26de7be8

Edit this page Report a problem