atan()

The atan() function returns the arctangent (inverse tangent) of the input value in radians.

Syntax

atan(NUM_EXPR)

Parameters

NUM_EXPR
A numeric expression whose arctangent is to be computed.

Description

The atan() function applies Math.atan() to the input and returns the result as a 64-bit double. The return value is in the range of -PI/2 to PI/2. 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.

Error codes

N/A

Usage examples

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

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

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

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

Compatibility

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