ASIN returns an angle from a sine ratio, but it cannot recover every original angle from that ratio. I keep the source angle when that distinction matters. Different angles can have the same sine.

Supply a ratio rather than degrees
The first query supplies explicitly typed sine ratios. Negative one, zero and positive one are useful boundary cases. Two half-ratios expose the sign of the returned angle.
The expected six-place radian displays are negative 1.570796, negative 0.523599, zero, 0.523599 and 1.570796. Those values form the selected inverse-sine answers for these inputs. They are not degree measurements.
The expression passes either a supported ratio or a typed NULL into ASIN. The status column keeps missing input separate from the supplied outside value. The query never passes an outside-domain argument to ASIN.
The function’s approximate result is displayed through decimal(10,6). This controls the printed scale. It does not make the trigonometric calculation exact decimal arithmetic.
WITH Ratios AS
(
SELECT CaseId,SineRatio
FROM (VALUES (1,CAST(-1 AS decimal(4,2))),(2,CAST(-0.5 AS decimal(4,2))),
(3,CAST(0 AS decimal(4,2))),(4,CAST(0.5 AS decimal(4,2))),
(5,CAST(1 AS decimal(4,2))),(6,CAST(NULL AS decimal(4,2))),
(7,CAST(1.1 AS decimal(4,2)))) AS v(CaseId,SineRatio)
)
SELECT CaseId,SineRatio,
CAST(ASIN(CASE WHEN SineRatio BETWEEN -1 AND 1
THEN CAST(SineRatio AS float) ELSE CAST(NULL AS float) END)
AS decimal(10,6)) AS PrincipalRadians,
CASE WHEN SineRatio IS NULL THEN N'Missing'
WHEN SineRatio BETWEEN -1 AND 1 THEN N'Valid'
ELSE N'Outside domain' END AS InputStatus
FROM Ratios
ORDER BY CaseId;An inverse calculation can lose the original branch
The second query starts with thirty and one hundred fifty degrees. Both have an expected sine display of 0.500000. The same ratio therefore cannot identify which source angle was used.
Applying ASIN to either computed ratio is expected to recover thirty degrees in the displayed model. It does not recover one hundred fifty for the second row. The OriginalDegrees column preserves the information the ratio alone lost.
This is different from a failed database conversion. The source relationship itself is not one-to-one across all angles. An application needs additional angle-range or orientation information to choose another valid branch.
I wouldn’t use an inverse sine as a universal undo operation. First establish the permitted original-angle interval. Then decide whether the returned branch matches that application contract.
WITH Angles AS
(
SELECT OriginalDegrees FROM (VALUES (CAST(30 AS int)),(150)) AS v(OriginalDegrees)
)
SELECT OriginalDegrees,
CAST(SIN(RADIANS(CAST(OriginalDegrees AS float))) AS decimal(10,6)) AS SineDisplay,
CAST(DEGREES(ASIN(SIN(RADIANS(CAST(OriginalDegrees AS float)))))
AS decimal(10,6)) AS RecoveredDegrees
FROM Angles
ORDER BY OriginalDegrees;
Keep input validity separate from ambiguity
A ratio outside negative one through positive one is invalid for this calculation. Two valid angles sharing one ratio are an ambiguity instead. These are different problems and need different outcomes.
The outside sample is expected to retain its supplied ratio and report Outside domain. Its displayed angle is NULL. That is a deliberate refusal, not another valid answer hiding in the same branch.
The missing ratio also produces a NULL angle, with a different status. Neither state is silently replaced by zero. Zero is already a meaningful ratio and a meaningful expected angle in this example.
Clamping an unsuitable ratio would change the source data. A tolerance policy can be specified for a particular measurement process. This example supplies no tolerance and does not silently repair an outside input.

Keep the units and source information explicit
The two grids use no tables or session settings. Their inputs are fixed sample values. The expected displays are intended for direct comparison with your own query results.
Radians and degrees are converted explicitly in the second expression. Leaving out RADIANS would change what SIN receives. Renaming an output column does not convert its unit.
I’d keep unit names in source and result columns when adapting the query. Preserve the source angle if another step needs its original branch. A small ratio cannot carry that information by itself.
The examples show displayed approximations rather than exact floating-point identities. A measurement workflow may need a separate tolerance for comparisons. It also needs a rule for incomplete source measurements.
Test two different valid source angles sharing a ratio when reversibility matters. A test containing only thirty degrees could misleadingly look perfectly reversible. The second source row makes the lost distinction visible.
Keep the source angle, and the ratio never has to carry it alone.
An inverse angle is not a reconstruction, it is one answer from a shared ratio.
Published by Pinal Dave on SQLAuthority. More of my work at pinaldave.com.
Discover more from SQL Authority with Pinal Dave
Subscribe to get the latest posts sent to your email.




