Mathematical Functions

math::abs()

Return the absolute value of the input x.

math::ceil()

Round up to the nearest integer.

math::floor()

Round down to the nearest integer.

math::ln()

Return the natural logarithm of the input value.

math::lg()

Return the base 10 logarithm of the input value.

math::log()

Return the logarithm of the input value in the specified base.

math::mean()

Return the arithmetic mean of the input set.

math::stddev()

Return the sample standard deviation of the input set.

math::stddev_pop()

Return the population standard deviation of the input set.

math::var()

Return the sample variance of the input set.

math::var_pop()

Return the population variance of the input set.

function

math::abs()

Math - 图1

Math - 图2

Math - 图3

math::abs(x: anyreal) -> anyreal

Return the absolute value of the input x.

  1. db>
  1. select math::abs(1);
  1. {1}
  1. db>
  1. select math::abs(-1);
  1. {1}

function

math::ceil()

Math - 图4

Math - 图5

Math - 图6

math::ceil(x: int64) -> float64math::ceil(x: float64) -> float64math::ceil(x: bigint) -> bigintmath::ceil(x: decimal) -> decimal

Round up to the nearest integer.

  1. db>
  1. select math::ceil(1.1);
  1. {2}
  1. db>
  1. select math::ceil(-1.1);
  1. {-1}

function

math::floor()

Math - 图7

Math - 图8

Math - 图9

math::floor(x: int64) -> float64math::floor(x: float64) -> float64math::floor(x: bigint) -> bigintmath::floor(x: decimal) -> decimal

Round down to the nearest integer.

  1. db>
  1. select math::floor(1.1);
  1. {1}
  1. db>
  1. select math::floor(-1.1);
  1. {-2}

function

math::ln()

Math - 图10

Math - 图11

Math - 图12

math::ln(x: int64) -> float64math::ln(x: float64) -> float64math::ln(x: decimal) -> decimal

Return the natural logarithm of the input value.

  1. db>
  1. select 2.718281829 ^ math::ln(100);
  1. {100.00000009164575}

function

math::lg()

Math - 图13

Math - 图14

Math - 图15

math::lg(x: int64) -> float64math::lg(x: float64) -> float64math::lg(x: decimal) -> decimal

Return the base 10 logarithm of the input value.

  1. db>
  1. select 10 ^ math::lg(42);
  1. {42.00000000000001}

function

math::log()

Math - 图16

Math - 图17

Math - 图18

math::log(x: decimal, named only base: decimal) -> decimal

Return the logarithm of the input value in the specified base.

  1. db>
  1. select 3 ^ math::log(15n, base := 3n);
  1. {15.0000000000000005n}

function

math::mean()

Math - 图19

Math - 图20

Math - 图21

math::mean(vals: set of int64) -> float64math::mean(vals: set of float64) -> float64math::mean(vals: set of decimal) -> decimal

Return the arithmetic mean of the input set.

  1. db>
  1. select math::mean({1, 3, 5});
  1. {3}

function

math::stddev()

Math - 图22

Math - 图23

Math - 图24

math::stddev(vals: set of int64) -> float64math::stddev(vals: set of float64) -> float64math::stddev(vals: set of decimal) -> decimal

Return the sample standard deviation of the input set.

  1. db>
  1. select math::stddev({1, 3, 5});
  1. {2}

function

math::stddev_pop()

Math - 图25

Math - 图26

Math - 图27

math::stddev_pop(vals: set of int64) -> float64math::stddev_pop(vals: set of float64) -> float64math::stddev_pop(vals: set of decimal) -> decimal

Return the population standard deviation of the input set.

  1. db>
  1. select math::stddev_pop({1, 3, 5});
  1. {1.63299316185545}

function

math::var()

Math - 图28

Math - 图29

Math - 图30

math::var(vals: set of int64) -> float64math::var(vals: set of float64) -> float64math::var(vals: set of decimal) -> decimal

Return the sample variance of the input set.

  1. db>
  1. select math::var({1, 3, 5});
  1. {4}

function

math::var_pop()

Math - 图31

Math - 图32

Math - 图33

math::var_pop(vals: set of int64) -> float64math::var_pop(vals: set of float64) -> float64math::var_pop(vals: set of decimal) -> decimal

Return the population variance of the input set.

  1. db>
  1. select math::var_pop({1, 3, 5});
  1. {2.66666666666667}