{ “title”: “SEC”, “language”: “en”, “description”: “Returns the secant of x, where x is the value in radians, only input and output are supported as double. Input null value will return null value.” }

Description

Returns the secant of x, where x is the value in radians, only input and output are supported as double. Input null value will return null value.

Syntax

SEC(<x>)

Parameters

ParameterDescription
<x>The value for which the secant is to be calculated

Return Value

Returns a Double type value means the secant of x.

Special Cases

  • When x is NaN, returns NaN
  • When x is positive or negative infinity, returns NaN
  • When x is NULL, returns NULL

Example

select sec(1),sec(2),sec(1000);
+--------------------+--------------------+--------------------+
| sec(1)             | sec(2)             | sec(1000)          |
+--------------------+--------------------+--------------------+
| 1.8508157176809255 | -2.402997961722381 | 1.7781600385912715 |
+--------------------+--------------------+--------------------+

Input null value.

select sec(null);
+--------------------+
| sec(null)          |
+--------------------+
|      NULL          |
+--------------------+
select sec(cast('nan' as double));
+---------------------------+
| sec(cast('nan' AS DOUBLE))|
+---------------------------+
| NaN                       |
+---------------------------+
select sec(cast('inf' as double));
+---------------------------+
| sec(cast('inf' AS DOUBLE))|
+---------------------------+
| NaN                       |
+---------------------------+
select sec(cast('-inf' as double));
+----------------------------+
| sec(cast('-inf' AS DOUBLE))|
+----------------------------+
| NaN                        |
+----------------------------+