|
abs ( numeric_type ) → numeric_type
绝对值
abs(-17.4) → 17.4
|
|
cbrt ( double precision ) → double precision
立方根
cbrt(64.0) → 4
|
|
ceil ( numeric ) → numeric
ceil ( double precision ) → double precision
大于或等于参数的最接近的整数
ceil(42.2) → 43
ceil(-42.8) → -42
|
|
ceiling ( numeric ) → numeric
ceiling ( double precision ) → double precision
大于或等于参数的最接近的整数 (与 ceil 相同)
ceiling(95.3) → 96
|
|
degrees ( double precision ) → double precision
将弧度转换为角度
degrees(0.5) → 28.64788975654116
|
|
div ( y numeric, x numeric ) → numeric
y/x 的整数商(截断为零位)
div(9, 4) → 2
|
|
exp ( numeric ) → numeric
exp ( double precision ) → double precision
指数 (e 的给定次方)
exp(1.0) → 2.7182818284590452
|
|
erf ( double precision ) → double precision
误差函数
erf(1.0) → 0.8427007929497149
|
|
erfc ( double precision ) → double precision
互补误差函数(1 - erf(x),对较大输入不会损失精度)
erfc(1.0) → 0.15729920705028513
|
|
factorial ( bigint ) → numeric
阶乘
factorial(5) → 120
|
|
floor ( numeric ) → numeric
floor ( double precision ) → double precision
小于或等于参数的最接近整数
floor(42.8) → 42
floor(-42.8) → -43
|
|
gcd ( numeric_type, numeric_type ) → numeric_type
最大公约数 (能将两个输入数整除而无余数的最大正数); 如果两个输入为零则返回 0 ; 适用于 integer, bigint,和 numeric
gcd(1071, 462) → 21
|
|
lcm ( numeric_type, numeric_type ) → numeric_type
最小公倍数(两个输入的整数倍的最小的严格正数);如果任意一个输入值为零则返回0;适用于integer,bigint,和 numeric
lcm(1071, 462) → 23562
|
|
ln ( numeric ) → numeric
ln ( double precision ) → double precision
自然对数
ln(2.0) → 0.6931471805599453
|
|
log ( numeric ) → numeric
log ( double precision ) → double precision
以10为底的对数
log(100) → 2
|
|
log10 ( numeric ) → numeric
log10 ( double precision ) → double precision
以10为底的对数 (与 log 相同)
log10(1000) → 3
|
|
log ( b numeric, x numeric ) → numeric
以b为底对参数x取对数
log(2.0, 64.0) → 6.0000000000000000
|
|
min_scale ( numeric ) → integer
精确表示所提供值所需的最小刻度(小数位数)
min_scale(8.4100) → 2
|
|
mod ( y numeric_type, x numeric_type ) → numeric_type
y/x的余数; 适用于smallint、integer、bigint、和 numeric
mod(9, 4) → 1
|
|
pi ( ) → double precision
π的近似值
pi() → 3.141592653589793
|
|
power ( a numeric, b numeric ) → numeric
power ( a double precision, b double precision ) → double precision
a的b次幂
power(9, 3) → 729
|
|
radians ( double precision ) → double precision
将角度转换为弧度
radians(45.0) → 0.7853981633974483
|
|
round ( numeric ) → numeric
round ( double precision ) → double precision
四舍五入到最近的整数。 对于numeric,遇到恰好位于中点的情况时按远离零的方向舍入。 对于double precision,中点取舍规则取决于平台,但“舍入到最接近的偶数”是最常见的规则。
round(42.4) → 42
|
|
round ( v numeric, s integer ) → numeric
将v舍入到s位小数。遇到恰好位于中点的情况时按远离零的方向舍入。
round(42.4382, 2) → 42.44
round(1234.56, -1) → 1230
|
|
scale ( numeric ) → integer
参数的刻度(小数点后的位数)
scale(8.4100) → 4
|
|
sign ( numeric ) → numeric
sign ( double precision ) → double precision
参数的符号 (-1, 0, 或 +1)
sign(-8.4) → -1
|
|
sqrt ( numeric ) → numeric
sqrt ( double precision ) → double precision
平方根
sqrt(2) → 1.4142135623730951
|
|
trim_scale ( numeric ) → numeric
通过删除尾数部分的零来降低值的刻度(小数位数)
trim_scale(8.4100) → 8.41
|
|
trunc ( numeric ) → numeric
trunc ( double precision ) → double precision
截断整数 (向零靠近)
trunc(42.8) → 42
trunc(-42.8) → -42
|
|
trunc ( v numeric, s integer ) → numeric
截断 v 到 s 位小数位置的数字
trunc(42.4382, 2) → 42.43
|
|
width_bucket ( operand numeric, low numeric, high numeric, count integer ) → integer
width_bucket ( operand double precision, low double precision, high double precision, count integer ) → integer
返回柱状图中包含 operand 的桶编号。该柱状图把 low 到 high 的范围划分为 count 个等宽桶。各桶包含下边界、不包含上边界。对于小于 low 的输入,返回 0;对于大于等于 high 的输入,返回 count+1。如果 low > high,行为会镜像反转,此时桶 1 表示刚好位于 low 下方的那个桶,并且包含边界的一侧改为上边界。
width_bucket(5.35, 0.024, 10.06, 5) → 3
width_bucket(9, 10, 0, 10) → 2
|
|
width_bucket ( operand anycompatible, thresholds anycompatiblearray ) → integer
给定一个列出各桶包含性下边界的数组,返回 operand 所落入的桶编号。对于小于第一个下界的输入,返回 0。operand 和数组元素可以是任何具有标准比较操作符的类型。thresholds 数组必须有序,且最小值在前,否则会得到意外结果。
width_bucket(now(), array['yesterday', 'today', 'tomorrow']::timestamptz[]) → 2
|