选择 打开 改范围 完整检索页

pgsql.cc 提供对 postgresql.org 官网内容的中文翻译,由 Pigsty 团队维护。

文档 / 函数百科 / 数学函数和操作符

FUNCTION数学函数和操作符

factorial

阶乘

Factorial

数学函数和操作符 引入 9.5 现存至 20 devel 1 条签名 0 次签名变更

签名数
1 条
引入版本
9.5
状态
现存
签名变更
未变过
本版来源
本站译文

PostgreSQL 18 手册 · 9.3 数学函数和操作符 官方文档

版本轨迹

相对 PostgreSQL 17 无变化。

签名

PostgreSQL 18 里 factorial 的 1 条签名,按上游手册顺序排列。参数名用斜体,类型用弱化色, 之后是返回类型。说明取自本站手册译文:标「沿用」的借用了另一版的译文,标「EN」的本站暂无译文、按英文原文显示。

  1. factorial ( bigint ) → numeric

    阶乘
    • factorial(5)120

演化历史

相邻两个大版本之间的差异,新的在前。版本号链到该版的签名。

  1. PostgreSQL 13 ← 12 手册重排

    这一跳手册重排了函数表的写法,签名文本整体改写,只记函数的增删,不逐条比较签名。

  2. PostgreSQL 9.5 ← 9.4 新增此函数

    PostgreSQL 9.5 起可用

签名矩阵

每条签名在给出了签名的 13 个版本里的存在情况;方格指向该版的签名。只在正文里提到此函数、没有给出签名的版本不列进来,上面的版本轨迹里仍然有它们。签名文本在 PostgreSQL 13 前后写法不同,跨越那一跳的同一条签名会显示成两行。

存在 不存在

签名 9.59.61011121314151617181920
factorial ( bigint ) → numeric 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在

同组函数

函数 签名 主签名 版本变动 最近变更
MATHEMATICAL FUNCTIONS AND OPERATORS 数学函数和操作符 55 个
abs基线 1 abs ( numeric_type ) → numeric_type
绝对值 现存
acos基线 1 acos ( double precision ) → double precision
反余弦,结果为弧度 现存
acosd 1 acosd ( double precision ) → double precision
反余弦,结果为度数 现存
acosh 1 acosh ( double precision ) → double precision
反双曲余弦 现存
asin基线 1 asin ( double precision ) → double precision
反正弦,结果为弧度 现存
asind 1 asind ( double precision ) → double precision
反正弦,结果为度数 现存
asinh 1 asinh ( double precision ) → double precision
反双曲正弦 现存
atan基线 1 atan ( double precision ) → double precision
反正切,结果为弧度 现存
atan2基线 1 atan2 ( y double precision, x double precision ) → double precision
y/x的反正切,结果为弧度 现存
atan2d 1 atan2d ( y double precision, x double precision ) → double precision
y/x的反正切,结果为度数 现存
atand 1 atand ( double precision ) → double precision
反正切,结果为度数 现存
atanh 1 atanh ( double precision ) → double precision
反双曲切线 现存
cbrt基线 1 cbrt ( double precision ) → double precision
立方根 现存
ceil基线 2 ceil ( numeric ) → numeric
大于或等于参数的最接近的整数 现存
ceiling基线 2 ceiling ( numeric ) → numeric
大于或等于参数的最接近的整数 (与 ceil 相同) 现存
cos基线 1 cos ( double precision ) → double precision
余弦,参数为弧度 现存
cosd 1 cosd ( double precision ) → double precision
余弦,参数为度数 现存
cosh 1 cosh ( double precision ) → double precision
双曲余弦 现存
cot基线 1 cot ( double precision ) → double precision
余切,参数为弧度 现存
cotd 1 cotd ( double precision ) → double precision
余切,参数为度数 现存
degrees基线 1 degrees ( double precision ) → double precision
将弧度转换为角度 现存
div基线 1 div ( y numeric, x numeric ) → numeric
y/x 的整数商(截断为零位) 现存
erf 1 erf ( double precision ) → double precision
误差函数 现存
erfc 1 erfc ( double precision ) → double precision
互补误差函数(1 - erf(x),对较大输入不会损失精度) 现存
exp基线 2 exp ( numeric ) → numeric
指数 (e 的给定次方) 现存
factorial 1 factorial ( bigint ) → numeric
阶乘 现存
floor基线 2 floor ( numeric ) → numeric
小于或等于参数的最接近整数 现存
gamma 1 gamma ( double precision ) → double precision
伽马函数 现存
gcd 1 gcd ( numeric_type, numeric_type ) → numeric_type
最大公约数 (能将两个输入数整除而无余数的最大正数); 如果两个输入为零则返回 0 ; 适用于 integer, bigint,和 numeric 现存
lcm 1 lcm ( numeric_type, numeric_type ) → numeric_type
最小公倍数(两个输入的整数倍的最小的严格正数);如果任意一个输入值为零则返回0;适用于integer,bigint,和 numeric 现存
lgamma 1 lgamma ( double precision ) → double precision
伽马函数绝对值的自然对数 现存
ln基线 2 ln ( numeric ) → numeric
自然对数 现存
log基线 3 log ( numeric ) → numeric
以10为底的对数 现存
log10 2 log10 ( numeric ) → numeric
以10为底的对数 (与 log 相同) 现存
min_scale 1 min_scale ( numeric ) → integer
精确表示所提供值所需的最小刻度(小数位数) 现存
mod基线 1 mod ( y numeric_type, x numeric_type ) → numeric_type
y/x的余数; 适用于smallint、integer、bigint、和 numeric 现存
pi基线 1 pi ( ) → double precision
π的近似值 现存
power基线 2 power ( a numeric, b numeric ) → numeric
a的b次幂 现存
radians基线 1 radians ( double precision ) → double precision
将角度转换为弧度 现存
random基线 7 random ( ) → double precision 192 次
返回一个范围 0.0 <= x < 1.0 中的随机值 现存
random_normal 1 random_normal ( [ mean double precision [, stddev double precision ]] ) → double precision
在Table 9.6和Table 9.33中列出的random()和random_normal()函数使用同一个确定性伪随机数生成器。 现存
round基线 3 round ( numeric ) → numeric
四舍五入到最近的整数。 现存
scale 1 scale ( numeric ) → integer
参数的刻度(小数点后的位数) 现存
setseed基线 1 setseed ( double precision ) → void
为后续的random()调用设置种子;参数必须在-1.0和1.0之间,包括边界值 现存
sign基线 2 sign ( numeric ) → numeric
参数的符号 (-1, 0, 或 +1) 现存
sin基线 1 sin ( double precision ) → double precision
正弦,参数为弧度 现存
sind 1 sind ( double precision ) → double precision
正弦,参数为度数 现存
sinh 1 sinh ( double precision ) → double precision
双曲正弦 现存
sqrt基线 2 sqrt ( numeric ) → numeric
平方根 现存
tan基线 1 tan ( double precision ) → double precision
正切,参数为弧度 现存
tand 1 tand ( double precision ) → double precision
正切,参数为度数 现存
tanh 1 tanh ( double precision ) → double precision
双曲切线 现存
trim_scale 1 trim_scale ( numeric ) → numeric
通过删除尾数部分的零来降低值的刻度(小数位数) 现存
trunc基线 5 trunc ( numeric ) → numeric 101 次
截断整数 (向零靠近) 现存
width_bucket基线 3 width_bucket ( operand numeric, low numeric, high numeric, count integer ) → integer 142 次
返回柱状图中包含 operand 的桶编号。 现存