MathMov运算

脚本命令详解

MathMov 变量 数学表达式 整数取值方式

参数详解
参数 含义
变量 变量名
数学表达式 通用的数学表达式
支持的单参数数学函数有:tan、sin、cos、sinh、cosh、arctan、cotan、arg、exp、ln、log10、log2、sqr、sqrt、abs、trunc、int、ceil、floor、heav、sign、zero、ph、rnd、random
整数取值方式 当赋值的变量为整数变量时,需要指定小数点的处理方式
1 向下取整
2 向上取整
3 四舍五入
不写则为不取整,精确到小数点后三位

例子:

;列出几个不同的计算方式

[@测试mathmov]

#if

#act

mov S$a 1

mov S$b 2

mov g10 10

mov p1 15


MathMov N1 (1+100+200)*50 2

SENDMSG 7 <$STR(N1)>


MathMov N1 ((<$str(s$a)>*<$str(s$b)>)+15/18-19/<$str(s$b)>)*<$str(g10)>/<$str(p1)>+999 2

SENDMSG 7 <$STR(N1)>


MathMov S1 ((<$str(s$a)>*<$str(s$b)>)+15/18-19/<$str(s$b)>)*<$str(g10)>/<$str(p1)>+999

SENDMSG 7 <$STR(S1)>


MathMov S2 sqr(4)+log2(<$str(g10)>)

SENDMSG 7 <$STR(S2)>


MathMov S3 max(1,2)

SENDMSG 7 <$STR(S3)>


MathMov N2 min(<$str(S$a)>,<$str(S$b)>)

SENDMSG 7 <$STR(N2)>