开源 企业版 高校版 私有云 模力方舟 AI 队友
代码拉取完成,页面将自动刷新
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
已有帐号? 立即登录
master
分支 (24)
标签 (112)
master
3.1
3.2
2.4
3.0
feature/tls_postgres
dialog_custom_ping_interval
uuid_doc_fix
feature/rtp_relay
feature/sql-cacher-iterators
coverity_scan
feature/pi
2.3
2.2
feature/new-globals-syntax
1.11
2.1
1.9
1.10
1.8
3.1.7
3.2.4
3.1.6
3.2.3
3.1.5
3.2.2
3.1.4
3.2.1
3.2.0
3.2.0-rc1
3.1.3
2.4.11
3.2.0-beta
2.4.10
3.1.2
3.0.5
2.4.9
3.0.4
3.1.1
3.1.0
master
分支 (24)
标签 (112)
master
3.1
3.2
2.4
3.0
feature/tls_postgres
dialog_custom_ping_interval
uuid_doc_fix
feature/rtp_relay
feature/sql-cacher-iterators
coverity_scan
feature/pi
2.3
2.2
feature/new-globals-syntax
1.11
2.1
1.9
1.10
1.8
3.1.7
3.2.4
3.1.6
3.2.3
3.1.5
3.2.2
3.1.4
3.2.1
3.2.0
3.2.0-rc1
3.1.3
2.4.11
3.2.0-beta
2.4.10
3.1.2
3.0.5
2.4.9
3.0.4
3.1.1
3.1.0
克隆/下载
克隆/下载
提示
下载代码请复制以下命令到终端执行
为确保你提交的代码身份被 Gitee 正确识别,请执行以下命令完成配置
初次使用 SSH 协议进行代码克隆、推送等操作时,需按下述提示完成 SSH 配置
1 生成 RSA 密钥
2 获取 RSA 公钥内容,并配置到 SSH公钥
在 Gitee 上使用 SVN,请访问 使用指南
使用 HTTPS 协议时,命令行会出现如下账号密码验证步骤。基于安全考虑,Gitee 建议 配置并使用私人令牌 替代登录密码进行克隆、推送等操作
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # 私人令牌
master
分支 (24)
标签 (112)
master
3.1
3.2
2.4
3.0
feature/tls_postgres
dialog_custom_ping_interval
uuid_doc_fix
feature/rtp_relay
feature/sql-cacher-iterators
coverity_scan
feature/pi
2.3
2.2
feature/new-globals-syntax
1.11
2.1
1.9
1.10
1.8
3.1.7
3.2.4
3.1.6
3.2.3
3.1.5
3.2.2
3.1.4
3.2.1
3.2.0
3.2.0-rc1
3.1.3
2.4.11
3.2.0-beta
2.4.10
3.1.2
3.0.5
2.4.9
3.0.4
3.1.1
3.1.0
opensips
/
modules
/
mathops
贡献代码
同步代码
对比差异 通过 Pull Request 同步
同步更新到分支
通过 Pull Request 同步
将会在向当前分支创建一个 Pull
Request,合入后将完成同步
File empty ...
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
mathops Module
 __________________________________________________________
 Table of Contents
 1. Admin Guide
 1.1. Overview
 1.2. Dependencies
 1.2.1. OpenSIPS Modules
 1.2.2. External Libraries or Applications
 1.3. Exported Parameters
 1.3.1. decimal_digits (integer)
 1.4. Exported Functions
 1.4.1. math_eval(expression, result_var)
 1.4.2. math_rpn(expression, result_var)
 1.4.3. math_trunc(number, result_var)
 1.4.4. math_floor(number, result_var)
 1.4.5. math_ceil(number, result_var)
 1.4.6. math_round(number, result_var[, decimals])
 1.4.7. math_round_sf(number, result_var, figures)
 2. Contributors
 2.1. By Commit Statistics
 2.2. By Commit Activity
 3. Documentation
 3.1. Contributors
 List of Tables
 2.1. Top contributors by DevScore^(1), authored commits^(2) and
 lines added/removed^(3)
 2.2. Most recently active contributors^(1) to this module
 List of Examples
 1.1. Setting the decimal_digits module parameter
 1.2. math_eval usage
 1.3. math_rpn usage
 1.4. math_trunc usage
 1.5. math_floor usage
 1.6. math_ceil usage
 1.7. math_round usage
 1.8. math_round_sf usage
Chapter 1. Admin Guide
1.1. Overview
 The mathops module provides a series of functions which enable
 various floating point operations at OpenSIPS script level.
1.2. Dependencies
1.2.1. OpenSIPS Modules
 The following modules must be loaded before this module:
 * No dependencies on other OpenSIPS modules..
1.2.2. External Libraries or Applications
 The following libraries or applications must be installed
 before running OpenSIPS with this module loaded:
 * None.
1.3. Exported Parameters
1.3.1. decimal_digits (integer)
 The precision of the results returned by all the module
 functions. The higher the "decimal_digits" value, the more
 decimal digits the results will have.
 Default value is "6".
 Example 1.1. Setting the decimal_digits module parameter
modparam("mathops", "decimal_digits", 10)
1.4. Exported Functions
1.4.1. math_eval(expression, result_var)
 The function evaluates a given expression and writes the result
 in the output pseudo-variable. Evaluation uses tinyexpr (see
 https://github.com/codeplea/tinyexpr).
 Currently allowed syntax for specifying an expression:
 * Nested parentheses
 * addition (+), subtraction/negation (-), multiplication (*),
 division (/), exponentiation (^) and modulus (%) with the
 normal operator precedence (the one exception being that
 exponentiation is evaluated left-to-right)
 * C math functions: abs (calls to fabs), acos, asin, atan,
 ceil, cos, cosh, exp, floor, ln (calls to log), log (calls
 to log10), sin, sinh, sqrt, tan, tanh
 Meaning of the parameters is as follows:
 * expression (string) - a mathematical expression.
 * result_var (var) - variable which will hold the result of
 the evaluation.
 This function can be used from any route.
 Example 1.2. math_eval usage
...
# Compute some random math expression
$avp(1) = "3.141592";
$avp(2) = "2.71828";
$avp(3) = "123.45678";
if (math_eval("$avp(1) * ($avp(3) - ($avp(1) - $avp(2))) / $avp(3)", $av
p(result))) {
 xlog("Result of expression: $avp(result)\n");
} else {
 xlog("Math eval failed!\n");
}
...
1.4.2. math_rpn(expression, result_var)
 The function evaluates a given RPN expression and writes the
 result in the output variable.
 The expression is specified in Reverse Polish Notation. Values
 are pushed onto a stack, while operations are executed on that
 stack. The following operations are supported:
 * binary operators: + - / * mod pow
 * unary functions: neg exp ln log10 abs sqrt cbrt floor ceil
 round nearbyint trunc
 neg will change the sign of the top of the stack
 ln is natural logarithm; abs is absolute value; other
 functions are standard C functions
 * constants: e pi
 * stack manipulations commands: drop dup swap
 Meaning of the parameters is as follows:
 * expression (string) - a RPN expression.
 * result_var (var) - variable which will hold the result of
 the evaluation.
 This function can be used from any route.
 Example 1.3. math_rpn usage
$avp(1) = "3";
if (math_rpn("1 $avp(1) swap swap dup drop / exp ln 1 swap /", $avp(resu
lt))) {
 xlog("Result of expression: $avp(result)\n");
} else {
 xlog("RPN eval failed!\n");
}
/* This example RPN script will push 1 then 3 onto the stack, then do a
couple no-ops
(exchange the two values twice, duplicate one of them then drop the dupl
icate),
compute the division of 1 by 3, then do another no-op (exponentiation th
en logarithm), and
finally compute 1 divided by the result, giving 3 as the result. */
1.4.3. math_trunc(number, result_var)
 Truncation of a number towards zero. This means that trunc(3.7)
 = 3.0 and trunc(-2.9) = -2.0.
 Meaning of the parameters is as follows:
 * number (string) - Number to be truncated.
 * result_var (var) - variable which will hold the result of
 the evaluation.
 This function can be used from any route.
 Example 1.4. math_trunc usage
...
# Truncate a random number
$avp(1) = "3.141492";
if (math_trunc($avp(1), $avp(result))) {
 xlog("Truncate result: $avp(result)\n");
} else {
 xlog("Truncate failed!\n");
}
...
1.4.4. math_floor(number, result_var)
 Truncates a number, always towards -infinity. This means that
 floor(3.7) = 3.0 and floor(-2.9) = -3.0
 Meaning of the parameters is as follows:
 * number (string) - Number to be truncated.
 * result_var (var) - variable which will hold the result of
 the evaluation.
 This function can be used from any route.
 Example 1.5. math_floor usage
...
# Truncate a random number
$avp(1) = "3.141492";
if (math_floor($avp(1), $avp(result))) {
 xlog("Floor result: $avp(result)\n");
} else {
 xlog("Floor operation failed!\n");
}
...
1.4.5. math_ceil(number, result_var)
 Truncates a number, always towards +infinity. This means that
 ceil(3.2) = 4.0 and ceil(-2.9) = -2.0
 Meaning of the parameters is as follows:
 * number (string) - Number to be truncated.
 * result_var (var) - variable which will hold the result of
 the evaluation.
 This function can be used from any route.
 Example 1.6. math_ceil usage
...
# Truncate a random number
$avp(1) = "3.141492";
if (math_ceil($avp(1), $avp(result))) {
 xlog("Ceil result: $avp(result)\n");
} else {
 xlog("Ceil operation failed!\n");
}
...
1.4.6. math_round(number, result_var[, decimals])
 The round function returns the nearest integer, and
 tie-breaking is done away from zero. Examples: round(1.2) =
 1.0, round(0.5) = 1.0, round(-0.5) = -1.0
 By default, the function returns an integer. An additional
 parameter controls the number of decimal digits of the initial
 number which will be kept. The rounding will then be done using
 the remaining decimal digits, and the result will be a float
 value, represented as a string.
 Meaning of the parameters is as follows:
 * number (string) - Number to be rounded.
 * result_var - variable which will hold the result of the
 evaluation.
 * decimals (int, optional) - further improves the precision
 of the rounding.
 This function can be used from any route.
 Example 1.7. math_round usage
...
# Rounding PI
$avp(1) = "3.141492";
if (math_round($avp(1), $avp(result))) {
 # result should be: 3
 xlog("Round result: $avp(result)\n");
} else {
 xlog("Round operation failed!\n");
}
...
if (math_round($avp(1), $avp(result), 4)) {
 # result should be: "3.1415"
 xlog("Round result: $avp(result)\n");
} else {
 xlog("Round operation failed!\n");
}
...
1.4.7. math_round_sf(number, result_var, figures)
 To give a simple explanation, rounding to N significant figures
 is done by first obtaining the number resulted from keeping N
 significant figures (0 padded if necessary), then adjusting it
 if the N+1'th digit is greater or equal to 5.
 Some examples:
 * round_sf(17892.987, 1) = 20000
 round_sf(17892.987, 2) = 18000
 round_sf(17892.987, 3) = 17900
 round_sf(17892.987, 4) = 17890
 round_sf(17892.987, 5) = 17893
 round_sf(17892.987, 6) = 17893.0
 round_sf(17892.987, 7) = 17892.99
 Meaning of the parameters is as follows:
 * number (string) - Number to be rounded.
 * result_var (var) - variable which will hold the result of
 the evaluation.
 * figures - further improves the precision of the rounding.
 This function can be used from any route.
 Example 1.8. math_round_sf usage
...
# Rounding PI
$avp(1) = "3.141492";
if (math_round_sf($avp(1), $avp(result), 4)) {
 # result should be: "3.141"
 xlog("Round result: $avp(result)\n");
} else {
 xlog("Round operation failed!\n");
}
...
Chapter 2. Contributors
2.1. By Commit Statistics
 Table 2.1. Top contributors by DevScore^(1), authored
 commits^(2) and lines added/removed^(3)
 Name DevScore Commits Lines ++ Lines --
 1. Liviu Chircu (@liviuchircu) 26 12 1355 66
 2. Razvan Crainea (@razvancrainea) 10 8 39 44
 3. Vlad Patrascu (@rvlad-patrascu) 9 3 96 302
 4. Ryan Bullock (@rrb3942) 9 1 552 160
 5. Stephane Alnet 6 2 327 36
 6. Bogdan-Andrei Iancu (@bogdan-iancu) 4 2 3 1
 7. Julián Moreno Patiño 3 1 3 3
 8. Peter Lemenkov (@lemenkov) 3 1 1 1
 9. Maksym Sobolyev (@sobomax) 1 1 0 0
 (1) DevScore = author_commits + author_lines_added /
 (project_lines_added / project_commits) + author_lines_deleted
 / (project_lines_deleted / project_commits)
 (2) including any documentation-related commits, excluding
 merge commits. Regarding imported patches/code, we do our best
 to count the work on behalf of the proper owner, as per the
 "fix_authors" and "mod_renames" arrays in
 opensips/doc/build-contrib.sh. If you identify any
 patches/commits which do not get properly attributed to you,
 please submit a pull request which extends "fix_authors" and/or
 "mod_renames".
 (3) ignoring whitespace edits, renamed files and auto-generated
 files
2.2. By Commit Activity
 Table 2.2. Most recently active contributors^(1) to this module
 Name Commit Activity
 1. Maksym Sobolyev (@sobomax) Jan 2021 - Jan 2021
 2. Razvan Crainea (@razvancrainea) Aug 2015 - Oct 2019
 3. Liviu Chircu (@liviuchircu) Feb 2013 - Jun 2019
 4. Vlad Patrascu (@rvlad-patrascu) May 2017 - Apr 2019
 5. Bogdan-Andrei Iancu (@bogdan-iancu) Oct 2014 - Apr 2019
 6. Peter Lemenkov (@lemenkov) Jun 2018 - Jun 2018
 7. Ryan Bullock (@rrb3942) Feb 2016 - Feb 2016
 8. Julián Moreno Patiño Feb 2016 - Feb 2016
 9. Stephane Alnet Nov 2013 - Nov 2013
 (1) including any documentation-related commits, excluding
 merge commits
Chapter 3. Documentation
3.1. Contributors
 Last edited by: Vlad Patrascu (@rvlad-patrascu), Peter Lemenkov
 (@lemenkov), Liviu Chircu (@liviuchircu), Ryan Bullock
 (@rrb3942), Julián Moreno Patiño, Stephane Alnet.
 Documentation Copyrights:
 Copyright © 2013 www.opensips-solutions.com
举报
举报成功
我们将于2个工作日内通过站内信反馈结果给你!
请认真填写举报原因,尽可能描述详细。
请选择举报类型
取消
发送
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

简介

暂无描述
暂无标签
README
GPL-2.0
使用 GPL-2.0 开源许可协议
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
编辑仓库简介
简介内容
主页
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/phpgoer/opensips.git
git@gitee.com:phpgoer/opensips.git
phpgoer
opensips
opensips
master
点此查找更多帮助

搜索帮助

评论
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册

AltStyle によって変換されたページ (->オリジナル) /