asin()

The asin() function returns the arcsine (inverse sine) of the input value in radians.

Syntax

asin(NUM_EXPR)

Parameters

NUM_EXPR
A numeric expression whose arcsine is to be computed. The value must be between -1 and 1 (inclusive).

Description

The asin() function applies Math.asin() to the input and returns the result as a 64-bit double. If the input is a Number type, it is internally converted using doubleValue() before processing.

Returns null if the input is null or not a number. Returns NaN if the input is less than -1 or greater than 1.

Error codes

N/A

Usage examples

  1. Calculate the angle (0 degrees) whose sine is 0.

    json "{'val': 0}" | eval result = asin(val)
    | # result: 0.0
    
  2. Calculate the angle (90 degrees) whose sine is 1.

    json "{'val': 1}" | eval result = asin(val)
    | # result: 1.5707963267948966
    
  3. NULL input

    json "{'val': null}" | eval result = asin(val)
    | # result: null
    

Compatibility

The asin() function is available since before Sonar 4.0.