ASIN

Compute the inverse sine (arcsine) of a value, returning an angle in radians.

Category: mathReturns: DOUBLEDialect: Standard

Syntax

ASIN(expr)

Description

## Overview Returns the inverse sine of the input, producing an angle in radians whose sine equals the input. The result lies in the closed interval [-pi/2, pi/2]. ASIN is the algebraic inverse of SIN on its principal branch and appears most often in navigation, astronomy, and great-circle distance calculations. Because the input must represent a valid sine value, ASIN is domain-restricted. Values slightly outside [-1, 1] that arise from floating-point rounding (for example, after dot-product normalization) may surprise callers by turning into NULL. When the input can only be just beyond the boundary due to rounding, clamp with GREATEST(LEAST(x, 1), -1) before the call. ## Behavior - Domain: [-1, 1]. Values strictly outside this range return NULL. - Range: [-pi/2, pi/2] radians. - Returns NULL if the argument is NULL. - Is strictly increasing: ASIN preserves order on its domain. - ASIN(SIN(x)) equals x only for x in [-pi/2, pi/2]; for other x it returns the principal-value reflection. ## Numeric precision - Computed using the IEEE 754 double-precision asin routine. - Near the endpoints (+/-1) the derivative is unbounded, so small input changes produce large output swings. Results in that region are still accurate to within one ULP but differentiation downstream is unstable. - Normalize inputs with clamping when they come from cosine of a difference or from dot-products that can exceed 1 by tiny rounding errors. ## Compatibility - Conforms to the SQL standard definition of ASIN as a scalar DOUBLE function with domain [-1, 1]. - Matches typical mathematical library implementations.

Parameters

NameTypeDescription
exprSpecifies the sine value whose angle is returned. Must lie in the closed interval [-1, 1]. Values outside this range yield NULL.

Examples

-- Basic literal: arcsine of 0 is 0
SELECT ASIN(0);
-- Result: 0.0
-- Arcsine of 1 is pi/2
SELECT ASIN(1);
-- Result: 1.5707963267948966
-- Convert result to degrees
SELECT DEGREES(ASIN(0.5));
-- Result: 30.0
-- Out-of-domain input returns NULL
SELECT ASIN(1.5);
-- Result: NULL
-- NULL propagation
SELECT ASIN(NULL);
-- Result: NULL
-- Column use: recover elevation angle from a normalized vertical component
SELECT sample_id, DEGREES(ASIN(vertical_norm)) AS elevation_deg
FROM sensors.telemetry.beam_vectors;

Pitfalls

See Also

Open in interactive docs →   DeltaForge home →