atan
On this page

atan()

Function in Builtins

atan(x): single-argument arctangent, returning radians in (-π/2, π/2), component-wise.

import { atan } from 'typeshade'

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

Syntax

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

Parameters

x ReadonlyNode<K>

Return value

Node<K>

Description

atan(x): single-argument arctangent, returning radians in (-π/2, π/2), component-wise. It covers two quadrants only; use atan2 for the two-argument form, which recovers the full angle from a (y, x) pair with the sign information a plain ratio drops.

Examples

Example

import { fn, atan, exp, f32T } from 'typeshade'
// The Gudermannian function, 2·atan(exp(y)) − π/2, is built on atan(exp(y)).
const gudermannian = fn('gud', { y: f32T }, ({ y }) => atan(exp(y)))

Targets

TargetSupportNotes
WGSL (WebGPU) Supported

atan(x).

GLSL ES 3.00 (WebGL2) Supported

atan(x).

CPU oracle Supported

Evaluated in f64 by the oracle.

See also

Source

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

Edit this page Report a problem