Compute the cosecant (reciprocal of sine) of an angle in radians.
CSC(expr)
## Overview Returns the cosecant of an angle supplied in radians. Cosecant is the reciprocal of sine: CSC(x) = 1 / SIN(x). It appears in wave optics, surveying, and antenna pattern analysis wherever the slant length associated with a known perpendicular component must be recovered. Like the other reciprocal trigonometric functions, cosecant is unbounded and undefined where sine is zero (at integer multiples of pi). Evaluating CSC at the exact multiple returns a very large finite value rather than an error, because pi is not exactly representable in binary floating-point. ## Behavior - Accepts any finite DOUBLE value. Mathematically undefined at integer multiples of pi. - Returns a DOUBLE. The absolute value of the result is always at least 1 for stable inputs. - Returns NULL if the argument is NULL. - Matches 1.0 / SIN(x) to within one ULP in the stable range. - Is deterministic and anti-symmetric: CSC(-x) = -CSC(x). ## Numeric precision - Computed from SIN(x) using the IEEE 754 double-precision intrinsic. - Near multiples of pi, small input changes produce large output swings because sine is close to zero. - Argument magnitudes above roughly 1e15 lose meaningful precision. ## Compatibility - Conforms to the SQL standard definition of CSC as a scalar DOUBLE function. - Matches typical mathematical library implementations.
| Name | Type | Description |
|---|---|---|
expr | Specifies the angle in radians whose cosecant is returned. Accepts any finite DOUBLE value except integer multiples of pi (where sine is zero and cosecant is undefined). |
-- Basic literal: CSC of pi/2 is 1
SELECT CSC(PI() / 2);
-- Result: 1.0
-- Cosecant of pi/6 is 2
SELECT CSC(PI() / 6);
-- Result: 2.0000000000000004
-- Cosecant of 1 radian
SELECT CSC(1);
-- Result: 1.1883951057781212
-- Reciprocal identity
SELECT CSC(0.5), 1.0 / SIN(0.5);
-- Result: 2.085829642933488, 2.085829642933488
-- Near-singularity: CSC(PI()) returns a very large finite number
SELECT CSC(PI());
-- Result: 8.165619676597685E15
-- Column use: derive slant-range factor from elevation angle
SELECT observation_id, baseline_m * CSC(RADIANS(elevation_deg)) AS slant_range_m
FROM astronomy.catalog.observations;