sin()

Returns the sine of an angle specified in radians.

Syntax

sin(RADIAN_EXPR)

Parameters

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

Description

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

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 sine of 0 radians.

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

    json "{}" | eval s = sin(30 * 3.14159 / 180)
    | # s: 0.5000000679473413
    
  3. A non-numeric value returns null.

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

    json "{}" | eval s = sin(null)
    | # s: null
    

Compatibility

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