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
|
erf ( double precision ) → double precision
誤差函式
erf(1.0) → 0.8427007929497149
|
erfc ( double precision ) → double precision
互補誤差函式(1 - erf(x) ,對於大輸入值不會丟失精度)
erfc(1.0) → 0.15729920705028513
|
exp ( numeric ) → numeric
exp ( double precision ) → double precision
指數函式(e 的給定次冪)
exp(1.0) → 2.7182818284590452
|
factorial ( bigint ) → numeric
階乘
factorial(5) → 120
|
floor ( numeric ) → numeric
floor ( double precision ) → double precision
小於或等於引數的最近整數
floor(42.8) → 42
floor(-42.8) → -43
|
gamma ( double precision ) → double precision
Gamma 函式
gamma(0.5) → 1.772453850905516
gamma(6) → 120
|
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
|
lgamma ( double precision ) → double precision
Gamma 函式絕對值的自然對數
lgamma(1000) → 5905.220423209181
|
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
在具有 count 個等寬儲存桶(跨越 low 到 high 的範圍)的直方圖中,返回 operand 所屬的儲存桶編號。儲存桶的下限是包含的,上限是不包含的。小於 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
|