MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / asin

Function asin

src/compute-engine/interval/trigonometric.ts:230–253  ·  view source on GitHub ↗
(x: Interval | IntervalResult)

Source from the content-addressed store, hash-verified

228}
229
230/**
231 * Arc sine (inverse sine).
232 *
233 * Domain: [-1, 1], Range: [-pi/2, pi/2]
234 */
235export function asin(x: Interval | IntervalResult): IntervalResult {
236 const unwrapped = unwrapOrPropagate(x);
237 if (!Array.isArray(unwrapped)) return unwrapped;
238 const [xVal] = unwrapped;
239 // Entirely outside domain
240 if (xVal.lo > 1 || xVal.hi < -1) {
241 return { kind: 'empty' };
242 }
243
244 // Clip to domain if needed
245 if (xVal.lo < -1 || xVal.hi > 1) {
246 const clippedLo = Math.max(xVal.lo, -1);
247 const clippedHi = Math.min(xVal.hi, 1);
248 return {
249 kind: 'partial',
250 value: { lo: Math.asin(clippedLo), hi: Math.asin(clippedHi) },
251 domainClipped:
252 xVal.lo < -1 && xVal.hi > 1 ? 'both' : xVal.lo < -1 ? 'lo' : 'hi',
253 };
254 }
255
256 // Within domain - asin is monotonically increasing

Callers 3

acscFunction · 0.85
gen_cases.pyFile · 0.85

Calls 3

unwrapOrPropagateFunction · 0.90
okFunction · 0.90
asinMethod · 0.80

Tested by

no test coverage detected