Mathematical functions let you perform math operations on data, including rounding, trigonometry, logging and exponentiation, and random number generation (among other operations).
Function |
Usage and description |
Absolute Value |
Usage: ABS(X) Returns the absolute value of X. |
Arc Cosine |
Usage: ACOS(X) Returns the arc cosine of X, that is, the value whose cosine is X. Returns NULL if X is not in the range -1 to 1. |
Arc Sine |
Usage: ASIN(X) Returns the arc sine of X, that is, the value whose sine is X. Returns NULL if X is not in the range -1 to 1. |
Arc Tangent |
Usage: ATAN(X) Returns the arc tangent of X, that is, the value whose tangent is X. |
Arc Tangent Ratio |
Usage: ATAN2(X1,X2) Returns the arc tangent of X1 divided by X2. |
Cube Root |
Usage: CBRT(X) Returns the cube root of a number X. |
Ceiling |
Usage: CEILING(X) or CEIL(X) Returns the smallest integer value not less than X. In other words, it rounds up to the next whole number. |
Cosine |
Usage: COS(X) Returns the cosine of X, where X is given in radians. |
Cotangent |
Usage: COT(X) Returns the cotangent of X. |
Degrees |
Usage: DEGREES(X) Returns the argument X, converted from radians to degrees. |
Exp |
Usage: EXP(X) Returns the value of e (the base of natural logarithms) raised to the power of X. The inverse of this function is LN(). |
Floor |
Usage: FLOOR(X) Returns the largest integer value not greater than X. For exact-value numeric arguments, the return value has an exact-value numeric type. For string or floating-point arguments, the return value has a floating-point type. |
Ln |
Usage: LN(X) Returns the natural logarithm of X; that is, the base-e logarithm of X. If X is less than or equal to 0, then an error is returned. This function is the inverse of the EXP function. |
Log |
Usage: LOG(X) This function returns the base 10 logarithm of the number X. |
Modulo |
Usage: MOD(N,M), N % M, N MOD M Modulo operation. Returns the remainder of N divided by M. The number M cannot be 0, or an error will be returned. MOD() also works on values that have a fractional part and returns the exact remainder after division. |
Pi |
Usage: PI() Returns the value of pi. |
Power |
Usage: POWER(X,Y) or POW(X,Y) Returns the value of X raised to the power of Y. |
Radians |
Usage: RADIANS(X) Returns the argument X, converted from degrees to radians. (Note that pi radians equals 180 degrees.) |
Random |
Usage: RANDOM() Returns a random floating-point value v in the range 0 <= v < 1.0. |
Round |
Usage: ROUND(X), ROUND(X,D) Rounds the argument X to D decimal places. The rounding algorithm depends on the data type of X. D defaults to 0 if not specified. D can be negative to cause D digits left of the decimal point of the value X to become zero. The return type is the same type as that of the first argument (assuming that it is integer, double, or decimal). This means that for an integer argument, the result is an integer (no decimal places). |
Sign |
Usage: SIGN(X) Returns the sign of the argument as -1, 0, or 1, depending on whether X is negative, zero, or positive. |
Sine |
Usage: SIN(X) Returns the sine of X, where X is given in radians. |
Square Root |
Usage: SQRT(X) Returns the square root of a nonnegative number X. |
Tangent |
Usage: TAN(X) Returns the tangent of X, where X is given in radians. |
Truncate |
Usage: TRUNC(X,D) Returns the number X, truncated to D decimal places. If D is 0, the result has no decimal point or fractional part. D can be negative to cause D digits left of the decimal point of the value X to become zero. All numbers are rounded toward zero. |
Minimum Value |
Usage: LEAST(value1,value2,...) Returns the smallest (minimum) of the values provided. NULL will be returned if all inputs are NULL. |
Maximum Value |
Usage: GREATEST(value1,value2,...) Returns the largest (maximum) of the values provided. NULL will be returned if all inputs are NULL. |