Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
新增 阶乘、平均数、方差、随机数、弧度转度、度转弧度、对数 计算支持
更改pcall调用方式避免全局函数误调用
计算函数与核心逻辑解耦,方便后续添加
输入e调用e (需要在计算上下文中)
输入pi调用π (可直接调用)
目前已实现函数
-- 随机数
rdm(...)
-- 正弦
sin(x)
-- 双曲正弦
sinh(x)
-- 反正弦
asin(x)
-- 余弦
cos(x)
-- 双曲余弦
cosh(x)
-- 反余弦
acos(x)
-- 正切
tan(x)
-- 双曲正切
tanh(x)
-- 反正切
atan(x)
-- 返回以弧度为单位的点(x,y)相对于x轴的逆时针角度。y是点的纵坐标,x是点的横坐标
-- 返回范围从−π到π (以弧度为单位),其中负角度表示向下旋转,正角度表示向上旋转
-- 与atan(y/x)相比,能够正确处理边界情况(例如x=0)
atan2(y, x)
-- 将角度从弧度转换为度
deg(x)
-- 将角度从度转换为弧度
rad(x)
-- 返回 x*2^y
ldexp(x, y)
-- 返回 e^x
exp(x)
-- x的平方根 sqrt(x) = x^0.5
sqrt(x)
-- x为底的对数, log(10, 100) = log(100) / log(10)
log(x, y)
-- 自然数e为底的对数
loge(x)
-- 10为底的对数
log10(x)
-- 平均值
avg(...)
-- 方差
var(...)
-- 阶乘. 支持 12! 或者 fact(12) 两种调用方式
fact(x)