Mathematical Functions and Operators

Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API

Functions and operators for performing numeric calculations. Use mathematical functions to:

  • Perform arithmetic with operators for addition, subtraction, multiplication, division, and more.
  • Round and truncate values to integers or a set number of decimal places.
  • Compute powers, roots, and logarithms for exponential and scaling calculations.
  • Convert angles and compute trigonometric values for geometric calculations.

Considerations 

  • Except where noted, a function returns the same data type as its argument or returns an error in case of failure.
  • Many functions are provided in multiple forms with different argument types.
  • Bitwise operators work only on integral data types. The other operators are available for all numeric data types.

For more information about supported types, see Numeric Types.

Operators 

Perform arithmetic and bitwise operations:

Rounding and Truncation 

Round or truncate numeric values:

  • CEIL / CEILING — Round up to the nearest integer.
  • FLOOR — Round down to the nearest integer.
  • ROUND — Round to the nearest integer or to a number of decimal places.
  • TRUNC — Truncate toward zero.

Powers, Roots, and Logarithms 

Compute exponential and scaling values:

  • CBRT — Cube root.
  • EXP — Raise e to a power.
  • LN — Natural logarithm.
  • LOG — Base 10 logarithm or logarithm to a specified base.
  • POWER — Raise a number to a power.
  • SQRT — Square root.

Arithmetic Helpers 

Perform division, sign, and value operations:

  • ABS — Absolute value.
  • DIV — Integer quotient of two numbers.
  • MOD — Remainder of a division.
  • SIGN — Sign of a number.
  • WIDTH_BUCKET — Assign a value to a histogram bucket.

Constants and Random Values 

Generate constants and pseudorandom numbers:

  • PI — The constant π.
  • RANDOM — A pseudorandom value in the range 0.0 to 1.0.

Angle Conversion and Trigonometry 

Convert angles and compute trigonometric values:

Related Documentation