Formulation » 历史记录 » 修订 2
修订 1 (yangdefeng, 2023-08-17 16:09) → 修订 2/3 (yangdefeng, 2023-08-17 16:21)
h4. _*%{color:green}formulation%*_
四则运算计算
标签:命令定义|formulation>formulation
*格式*
|命令名 |参数1 |参数2 |参数3 |
|formulation |计算公式 |存入变量 |小数处理模式 |
说明:
* 参数1: 计算公式
/ 代表除
<notextile>* 代表乘</notextile>
+ 代表加
- 代表减
% 为取余数
() 优先计算括号
* 参数2: 存入变量
* 参数3: 小数处理模式
0或缺省,结果四舍五入
1,丢弃掉小数
-
-
h4. *%{color:deepskyblue}特戒引擎脚本示例:%*
bq. [<notextile>@</notextile>main]
#if
#act
*{color:green}formulation* formulation 2/(100+20)*100+100 n$切割值
[[print]] print 切割值为<$str(n$切割值)>
<notextile></notextile>
*{color:green}formulation* (10+20%9)%5 n$测试
[[print]] 6 <$str(n$测试)>
<notextile></notextile>
#if
#act
[[mov]] n$数字100 100
[[mov]] g50 50
[[mov]] i99 10
[[mov]] n80 80
[[mov]] u200 200
[[mov]] p80 80
[[mov]] m100 10
*{color:green}formulation* <notextile>(<$str(n$数字100)>+<$str(g50)>)/((<$str(i99)>+<$str(n80)>)*<$str(u200)>*(<$str(p80)>-12))+<$str(m100)></notextile> n$结果是4
[[print]] 4运算的结果是<$str(n$结果是4)>
*{color:green}formulation* 2/(100+20)*100+100 u249
[[print]] 1运算的结果是<$str(u249)>
*{color:green}formulation* <$str(n80)>*<$str(u200)> n$结果是
[[print]] 2变量相乘运算的结果是<$str(n$结果是)>