tan()

Returns the tangent of an angle specified in radians.

Syntax

tan(RADIAN_EXPR)

Parameters

RADIAN_EXPR
An angle in radians. Must be a numeric type.

Description

The tan() function returns the tangent of the angle specified in radians by RADIAN_EXPR as a 64-bit double. Internally uses Math.tan().

Returns null if RADIAN_EXPR is null or not a numeric type.

To use degree values, convert to radians first using the form degrees * 3.14159 / 180.

Error codes

N/A

Usage examples

  1. Calculate the tangent of 0 radians.

    json "{}" | eval t = tan(0)
    | # t: 0.0
    
  2. Convert an angle in degrees to radians and calculate the tangent.

    json "{}" | eval t = tan(45 * 3.14159 / 180)
    | # t: 0.9999996732051289
    
  3. A non-numeric value returns null.

    json "{}" | eval t = tan("0")
    | # t: null
    
  4. NULL input

    json "{}" | eval t = tan(null)
    | # t: null
    

Compatibility

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