Skip to content

Latest commit

 

History

History
660 lines (461 loc) · 18.6 KB

math.asciidoc

File metadata and controls

660 lines (461 loc) · 18.6 KB

Mathematical Functions

All math and trigonometric functions require their input (where applicable) to be numeric.

Generic

ABS

Synopsis:
ABS(numeric_exp) (1)

Input:

  1. numeric expression. If null, the function returns null.

Output: numeric

Description: Returns the {wikipedia}/Absolute_value[absolute value] of numeric_exp. The return type is the same as the input type.

include-tagged::{sql-specs}/docs/docs.csv-spec[abs]

CBRT

Synopsis:
CBRT(numeric_exp) (1)

Input:

  1. numeric expression. If null, the function returns null.

Output: double numeric value

Description: Returns the {wikipedia}/Cube_root[cube root] of numeric_exp.

include-tagged::{sql-specs}/docs/docs.csv-spec[mathInlineCbrtWithNegativeValue]

CEIL/CEILING

Synopsis:
CEIL(numeric_exp) (1)

Input:

  1. numeric expression. If null, the function returns null.

Output: integer or long numeric value

Description: Returns the smallest integer greater than or equal to numeric_exp.

include-tagged::{sql-specs}/docs/docs.csv-spec[mathInlineCeiling]

E

Synopsis:
E()

Input: none

Output: 2.718281828459045

Description: Returns {wikipedia}/E_%28mathematical_constant%29[Euler’s number].

include-tagged::{sql-specs}/docs/docs.csv-spec[mathEulersNumber]

EXP

Synopsis:
EXP(numeric_exp) (1)

Input:

  1. float numeric expression. If null, the function returns null.

Output: double numeric value

Description: Returns {wikipedia}/Exponential_function[Euler’s number at the power] of numeric_exp enumeric_exp.

include-tagged::{sql-specs}/docs/docs.csv-spec[mathExpInline]

EXPM1

Synopsis:
EXPM1(numeric_exp) (1)

Input:

  1. float numeric expression. If null, the function returns null.

Output: double numeric value

Description: Returns Euler’s number at the power of numeric_exp minus 1 (enumeric_exp - 1).

include-tagged::{sql-specs}/docs/docs.csv-spec[mathExpm1Inline]

FLOOR

Synopsis:
FLOOR(numeric_exp) (1)

Input:

  1. numeric expression. If null, the function returns null.

Output: integer or long numeric value

Description: Returns the largest integer less than or equal to numeric_exp.

include-tagged::{sql-specs}/docs/docs.csv-spec[mathInlineFloor]

LOG

Synopsis:
LOG(numeric_exp) (1)

Input:

  1. numeric expression. If null, the function returns null.

Output: double numeric value

Description: Returns the {wikipedia}/Natural_logarithm[natural logarithm] of numeric_exp.

include-tagged::{sql-specs}/docs/docs.csv-spec[mathInlineLog]

LOG10

Synopsis:
LOG10(numeric_exp) (1)

Input:

  1. numeric expression. If null, the function returns null.

Output: double numeric value

Description: Returns the {wikipedia}/Common_logarithm[base 10 logarithm] of numeric_exp.

include-tagged::{sql-specs}/docs/docs.csv-spec[mathInlineLog10]

PI

Synopsis:
PI()

Input: none

Output: 3.141592653589793

Description: Returns {wikipedia}/Pi[PI number].

include-tagged::{sql-specs}/docs/docs.csv-spec[mathPINumber]

POWER

Synopsis:
POWER(
    numeric_exp, (1)
    integer_exp) (2)

Input:

  1. numeric expression. If null, the function returns null.

  2. integer expression. If null, the function returns null.

Output: double numeric value

Description: Returns the value of numeric_exp to the power of integer_exp.

include-tagged::{sql-specs}/docs/docs.csv-spec[mathInlinePowerPositive]
include-tagged::{sql-specs}/docs/docs.csv-spec[mathInlinePowerNegative]

RANDOM/RAND

Synopsis:
RANDOM(seed) (1)

Input:

  1. numeric expression. If null, the function returns null.

Output: double numeric value

Description: Returns a random double using the given seed.

include-tagged::{sql-specs}/docs/docs.csv-spec[mathRandom]

ROUND

Synopsis:
ROUND(
    numeric_exp      (1)
    [, integer_exp]) (2)

Input:

  1. numeric expression. If null, the function returns null.

  2. integer expression; optional. If null, the function returns null.

Output: numeric

Description: Returns numeric_exp rounded to integer_exp places right of the decimal point. If integer_exp is negative, numeric_exp is rounded to |integer_exp| places to the left of the decimal point. If integer_exp is omitted, the function will perform as if integer_exp would be 0. The returned numeric data type is the same as the data type of numeric_exp.

include-tagged::{sql-specs}/docs/docs.csv-spec[mathRoundWithPositiveParameter]
include-tagged::{sql-specs}/docs/docs.csv-spec[mathRoundWithNegativeParameter]

SIGN/SIGNUM

Synopsis:
SIGN(numeric_exp) (1)

Input:

  1. numeric expression. If null, the function returns null.

Output: [-1, 0, 1]

Description: Returns an indicator of the sign of numeric_exp. If numeric_exp is less than zero, –1 is returned. If numeric_exp equals zero, 0 is returned. If numeric_exp is greater than zero, 1 is returned.

include-tagged::{sql-specs}/docs/docs.csv-spec[mathInlineSign]

SQRT

Synopsis:
SQRT(numeric_exp) (1)

Input:

  1. numeric expression. If null, the function returns null.

Output: double numeric value

Description: Returns {wikipedia}/Square_root[square root] of numeric_exp.

include-tagged::{sql-specs}/docs/docs.csv-spec[mathInlineSqrt]

TRUNCATE/TRUNC

Synopsis:
TRUNCATE(
    numeric_exp      (1)
    [, integer_exp]) (2)

Input:

  1. numeric expression. If null, the function returns null.

  2. integer expression; optional. If null, the function returns null.

Output: numeric

Description: Returns numeric_exp truncated to integer_exp places right of the decimal point. If integer_exp is negative, numeric_exp is truncated to |integer_exp| places to the left of the decimal point. If integer_exp is omitted, the function will perform as if integer_exp would be 0. The returned numeric data type is the same as the data type of numeric_exp.

include-tagged::{sql-specs}/docs/docs.csv-spec[mathTruncateWithPositiveParameter]
include-tagged::{sql-specs}/docs/docs.csv-spec[mathTruncateWithNegativeParameter]

Trigonometric

ACOS

Synopsis:
ACOS(numeric_exp) (1)

Input:

  1. numeric expression. If null, the function returns null.

Output: double numeric value

Description: Returns the {wikipedia}/Inverse_trigonometric_functions[arccosine] of numeric_exp as an angle, expressed in radians.

include-tagged::{sql-specs}/docs/docs.csv-spec[mathInlineAcos]

ASIN

Synopsis:
ASIN(numeric_exp) (1)

Input:

  1. numeric expression. If null, the function returns null.

Output: double numeric value

Description: Returns the {wikipedia}/Inverse_trigonometric_functions[arcsine] of numeric_exp as an angle, expressed in radians.

include-tagged::{sql-specs}/docs/docs.csv-spec[mathInlineAsin]

ATAN

Synopsis:
ATAN(numeric_exp) (1)

Input:

  1. numeric expression. If null, the function returns null.

Output: double numeric value

Description: Returns the {wikipedia}/Inverse_trigonometric_functions[arctangent] of numeric_exp as an angle, expressed in radians.

include-tagged::{sql-specs}/docs/docs.csv-spec[mathInlineAtan]

ATAN2

Synopsis:
ATAN2(
    ordinate, (1)
    abscisa)  (2)

Input:

  1. numeric expression. If null, the function returns null.

  2. numeric expression. If null, the function returns null.

Output: double numeric value

Description: Returns the {wikipedia}/Atan2[arctangent of the ordinate and abscisa coordinates] specified as an angle, expressed in radians.

include-tagged::{sql-specs}/docs/docs.csv-spec[mathInlineAtan2]

COS

Synopsis:
COS(numeric_exp) (1)

Input:

  1. numeric expression. If null, the function returns null.

Output: double numeric value

Description: Returns the {wikipedia}/Trigonometric_functions#cosine[cosine] of numeric_exp, where numeric_exp is an angle expressed in radians.

include-tagged::{sql-specs}/docs/docs.csv-spec[mathInlineCosine]

COSH

Synopsis:
COSH(numeric_exp) (1)

Input:

  1. numeric expression. If null, the function returns null.

Output: double numeric value

Description: Returns the {wikipedia}/Hyperbolic_function[hyperbolic cosine] of numeric_exp.

include-tagged::{sql-specs}/docs/docs.csv-spec[mathInlineCosh]

COT

Synopsis:
COT(numeric_exp) (1)

Input:

  1. numeric expression. If null, the function returns null.

Output: double numeric value

Description: Returns the {wikipedia}/Trigonometric_functions#Cosecant,_secant,_and_cotangent[cotangent] of numeric_exp, where numeric_exp is an angle expressed in radians.

include-tagged::{sql-specs}/docs/docs.csv-spec[mathInlineCotangent]

DEGREES

Synopsis:
DEGREES(numeric_exp) (1)

Input:

  1. numeric expression. If null, the function returns null.

Output: double numeric value

Description: Convert from {wikipedia}/Radian[radians] to {wikipedia}/Degree_(angle)[degrees].

include-tagged::{sql-specs}/docs/docs.csv-spec[mathInlineDegrees]

RADIANS

Synopsis:
RADIANS(numeric_exp) (1)

Input:

  1. numeric expression. If null, the function returns null.

Output: double numeric value

Description: Convert from {wikipedia}/Degree_(angle)[degrees] to {wikipedia}/Radian[radians].

include-tagged::{sql-specs}/docs/docs.csv-spec[mathInlineRadians]

SIN

Synopsis:
SIN(numeric_exp) (1)

Input:

  1. numeric expression. If null, the function returns null.

Output: double numeric value

Description: Returns the {wikipedia}/Trigonometric_functions#sine[sine] of numeric_exp, where numeric_exp is an angle expressed in radians.

include-tagged::{sql-specs}/docs/docs.csv-spec[mathInlineSine]

SINH

Synopsis:
SINH(numeric_exp) (1)

Input:

  1. numeric expression. If null, the function returns null.

Output: double numeric value

Description: Returns the {wikipedia}/Hyperbolic_function[hyperbolic sine] of numeric_exp.

include-tagged::{sql-specs}/docs/docs.csv-spec[mathInlineSinh]

TAN

Synopsis:
TAN(numeric_exp) (1)

Input:

  1. numeric expression. If null, the function returns null.

Output: double numeric value

Description: Returns the {wikipedia}/Trigonometric_functions#tangent[tangent] of numeric_exp, where numeric_exp is an angle expressed in radians.

include-tagged::{sql-specs}/docs/docs.csv-spec[mathInlineTanget]