# \*数学计算

eco 系列插件全部支持数学公式计算和变量符。

## 公式

在数值选项中可以使用变量符，例如你可以制作根据玩家金币数量决定伤害的武器，同时涉及内部等级的（例如附魔等级、宠物等级、技能等级等），往往插件自带 `%level%` 变量符。

* +：加号。例如 `1+2`。
* -：减号。例如 `5-3`。
* \*：乘号。
* /：除号。
* 你可以使用 `( )` 符号来优先处理公式中的某个部分。例如在 `1 + 2 * 3` 中，根据常识很明显正确的计算步骤是先算乘法再算加法，但你可以使用 `(1 + 2) *3` 来实现先算加法，再算乘法。公式中不能使用中括号和大括号，你可以使用 `(( ))` 符号来实现中括号。

## 函数

* max - 比较并取最大值。（max(4,5)）
* &#x20;min - 比较并取最小值。（min(4,5)）
* &#x20;() - 优先计算其中的表达式。（3 \* (4 + 1)）
* &#x20;$ - 表示变量。（$1 / 3）
* &#x20;e - 自然常数。（log(3)）
* &#x20;pi - 圆周率π。（sin(pi)）
* \+ - 将两数相加。（1 + 1）
* \-  - 将两数相减。（3-2、-(4+2)）
* &#x20;/ - 将两数相除。(3 / 4)
* \* - 将两数相乘。（2 \* 3）
* ^ - 将后者作为前者的指数进行幂运算。（3^3，即33）
* % - 余除。取余数。（7 % 4，返回 3）&#x20;
* abs - 取绝对值。（abs$1、abs-1）&#x20;
* round - 按五舍六入的方法将小数取整。（round1.5、round(2.3)）&#x20;
* ceil - 向上取整。（ceil1.05，返回 2）&#x20;
* floor - 向下取整。（floor0.95，返回 0）&#x20;
* rand - 在 0 和给定数间取一个随机整数。（rand4，返回可能是 0、1、2、3、4 中的一个）&#x20;
* log - 进行以自然常数 e 为底数的对数运算。（log(e)，返回 1）&#x20;
* sqrt - 对指定数取平方根。（sqrt4，即 √4，返回 2）&#x20;
* cbrt - 对指定数取立方根。（cbrt(8)，即3√8，返回 2）&#x20;
* sin - 正弦运算。（sin$2）&#x20;
* cos - 余弦运算。（cos2\*pi，即 cos(2π)，返回 1）
* tan - 正切运算。（tan2pi，即 tan(π)，返回 0）&#x20;
* asin - 反正弦运算。（atan1）&#x20;
* acos - 反余弦运算。（acos0.45）&#x20;
* atan - 反正切运算。（atan1）&#x20;
* sinh - 双曲正弦运算。（sinh(4)）&#x20;
* cosh - 双曲余弦运算。（cosh(4)）&#x20;
* true - 布尔值，表示 1（真）。&#x20;
* false - 布尔值，表示 0（假）。
* \= - 比较两侧数字是否相同。（1 = 1 返回 1，而 1 != 1 则会返回 0）
* \> -比较前一个数是否大于后一个数。（1 > 0，返回 1）
* < - 比较前一个数是否小于后一个数。（0 < 1，返回 1）
* \>= - 比较前一个数是否大等于后一个数。（1 >= 1，返回 1）&#x20;
* <= - 比较前一个数是否小等于后一个数。（0 <= 1，返回 1）
* \| - 布尔值的“或”比较符（true | false，返回 true），也接受 || 的格式。&#x20;
* & - 布尔值的“和”比较符（true & true，返回 true），也接受 && 的格式。&#x20;
* ! - 布尔值的“非”比较符（!true，返回 false）


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.superiormc.cn/auxilor-plugins/tong-yong-xin-xi/shu-xue-ji-suan.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
