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
|
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
精確表示所提供的值所需的最小 scale (小數位數)
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 (小數部分的位數)
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
透過移除尾隨零來減少值的 scale (小數位數)
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 落在哪一個儲存桶 (bucket) 的編號。此儲存桶屬於一個直方圖 (histogram),該直方圖具有 count 個等寬儲存桶,範圍從 low 到 high 。若輸入值超出該範圍,則傳回 0 或 count +1 。
width_bucket(5.35, 0.024, 10.06, 5) → 3
|
width_bucket ( operand anycompatible , thresholds anycompatiblearray ) → integer
傳回 operand 落在哪一個儲存桶的編號,給定一個陣列,其中列出儲存桶的下限。若輸入值小於第一個下限,則傳回 0 。operand 和陣列元素可以是任何具有標準比較運算子的類型。 thresholds 陣列必須經過排序,從小到大排列,否則會得到意想不到的結果。
width_bucket(now(), array['yesterday', 'today', 'tomorrow']::timestamptz[]) → 2
|