By continuing to use this site, you agree to the Terms of Service of this website, including usage of cookies.

OK, Don't show this again

Direct Download
How to install?

Switch version
4 Reviews

231 Downloads / 630 Total

**Execute math expressions in the server or console on PocketMine-MP servers with /calculator command**

- List of supported arithmetic operators:
`/`

,`*`

,`+`

,`-`

,`**`

,`%`

. - Description of arithmetic operators: https://github.com/Muqsit/arithmexp/wiki/Operator
- Eg:
`/calculator 1 + (2 - 3) * 4 / 5`

> Result:`0.2`

- List of supported constants:
`pi`

,`e`

,`log2e`

,`log10e`

,`ln2`

,`ln10`

,`pi2`

,`pi4`

,`m_1pi`

,`m_2pi`

,`sqrtpi`

,`m_2sqrtpi`

,`sqrt2`

,`sqrt3`

,`sqrt12`

,`lnpi`

,`euler`

,`nan`

,`inf`

. - Description of constants: https://github.com/Muqsit/arithmexp/wiki/Constant
- Eg:
`/calculator 3**2 * pi`

> Result:`28.2`

- List of supported math functions:
`abs`

,`acos`

,`acosh`

,`asin`

,`asinh`

,`atan2`

,`atan`

,`atanh`

,`ceil`

,`cos`

,`cosh`

,`deg2rad`

,`exp`

,`expm1`

,`fdiv`

,`floor`

,`fmod`

,`getrandmax`

,`hypot`

,`intdiv`

,`lcg_value`

,`log10`

,`log`

,`max`

,`min`

,`mt_getrandmax`

,`mt_rand`

,`pi`

,`pow`

,`rad2deg`

,`rand`

,`round`

,`sin`

,`sinh`

,`sqrt`

,`srand`

,`tan`

,`tanh`

. - Description of math functions: https://github.com/Muqsit/arithmexp/wiki/Function
- Eg:
`/calculator sqrt(369)`

> Result:`19.2`

```
commands:
calculator:
description: "Perform a math operation"
usage: "/calculator <expression>"
permission: calculator.command
aliases: ["calc"]
permissions:
calculator.command:
default: true
description: "Allows the use of /calculator"
```

```
---
# Prefix of messages.
prefix: "&f[&6Calculator&f]&r"
# {prefix} : Prefix.
# {result} : The result of the math.
result: "{prefix} &aResult: &b{result}"
# {prefix} : Prefix.
# {error} : Error information.
error: "{prefix} &cError: {error}"
# playSound: true > A sound will be sent to the player when a math expressions is performed.
playSound: true
# showDataType: true > The data type will be displayed with the result.
showDataType: true
# Config version
configVersion: "0.0.15"
...
```

What's new §

- 0.0.20
- 0.0.19
- 0.0.18
- 0.0.17
- 0.0.16
- 0.0.15
- 0.0.14
- 0.0.13
- 0.0.12
- 0.0.11
- 0.0.10
- 0.0.9
- 0.0.8
- 0.0.7
- 0.0.6
- 0.0.5
- 0.0.4
- 0.0.3
- 0.0.2
- 0.0.1

- API bump to 5.0.0
- Bump lib
`muqsit/arithmexp`

to`0.1.30`

- Bump lib
`NhanAZ/libBedrock`

to`1.0.0`

- Bump lib
`muqsit/arithmexp`

to`0.1.29`

- Fixed unary positive operation resulting in negation since v0.1.28 (
`80ceccf`

) - Further optimized expression evaluation (
`6d0c799`

) - Implemented modulo operator strength reduction for identity property (
`(a % n) % n`

=>`a % n`

) (`bca7b17`

,`9853547`

) - Removed functions
`rand()`

and`getrandmax()`

(these functions exist in PHP only for backward compatibility) (`ce8dfb3`

) `mt_rand()`

now accepts zero parameters (in addition to accepting two parameters) (`8194bf3`

,`f73be61`

)- Implemented mode constants for
`round()`

(`HALF_UP`

,`HALF_DOWN`

,`HALF_EVEN`

,`HALF_ODD`

) (`c21ce74`

,`90c0f5d`

) - Renamed
`FunctionRegistry::register()`

to`FunctionRegistry::register()`

(`ad07641`

) - Renamed
`ConstantRegistry::register()`

to`ConstantRegistry::registerLabel()`

(`1b0d2d5`

) - Moved
`FunctionRegistry::registerMacro()`

to`MacroRegistry::registerFunction()`

(`0d0889f`

) - Implemented object-like macros that can be registered by calling
`MacroRegistry::registerObject()`

(`34e5ad7`

)

- Fixed unary positive operation resulting in negation since v0.1.28 (

- Bump lib
`muqsit/arithmexp`

to`0.1.26`

- Introduced
`Parser::getOperatorManager()`

(`4ff725f`

) - Replaced
`Parser::getBinaryOperatorRegistry()`

with`Parser::getOperatorManager()->getBinaryRegistry()`

- Replaced
`Parser::getUnaryOperatorRegistry()`

with`Parser::getOperatorManager()->getUnaryRegistry()`

- Fixed a few cases where optimizers did not account for INF and NAN (#16) (
`1ef49eb`

,`db1df91`

,`03440ab`

,`b9dd31e`

,`3c9b8a0`

,`14442ca`

,`082ccf3`

) - Fixed operator precedence of unary operators being greater than exponentiation (#17) (
`4ff725f`

) - Fixed division by zero with zero
`0 / 0`

returning`int(0)`

with optimizations (`1672970`

) - Function properties (commutativity and determinism) are governed by function flags instead of boolean properties (3e34845)
- See newer examples on the wiki about how to register custom binary operators, unary operators, and functions
- Implemented idempotent functions (
`bd08609`

)

- Introduced

- Bump lib
`muqsit/arithmexp`

to`0.1.25`

- Fixed a bug that allowed using square brackets and curly brackets to enclose function call argument list (
`aa71629`

) - Errored subexpressions are no longer highlighted if the subexpression is the expression itself (
`65290a6`

) - Improved performance of operator strength reduction by precomputing numeric literals within operands (
`32cf8f4`

)

- Fixed a bug that allowed using square brackets and curly brackets to enclose function call argument list (

- Bump lib
`muqsit/arithmexp`

to`0.1.24`

- Added support for various forms of brackets (square brackets
`[]`

and curly brackets`{}`

are now considered as valid in expressions)

- Added support for various forms of brackets (square brackets

- Added option: Advanced brackets > Input will accept brackets: [ ] { }

- Bump lib
`muqsit/arithmexp`

to`0.1.23`

- Registered functions for a parser can now be accessed via
`FunctionRegistry::register()`

(`d003841`

) - Improved operator strength reduction performance over addition with negative operands (
`2bf277e`

,`ff81320`

) - Improved operator strength reduction performance over subtraction with negative operands (
`da21685`

,`ff81320`

) - Fixed a critical bug where operator strength reduction over subtraction with
`lvalue=0`

resulted in`rvalue`

instead of`-rvalue`

(#11,`4f4aaea`

,`029e470`

)

- Registered functions for a parser can now be accessed via

- Added option: Show data type of result
- Bump lib
`nhanaz-pm-pl/libBedrock`

to`0.0.2`

- Bump lib
`muqsit/arithmexp`

to`0.1.22`

- Implemented quotient rule of exponents (
`a ** m / a ** n = a ** (m - n)`

) in strength reduction optimization (`757e7b0`

) - Fixed a bug in the optimizer that caused function calls in expressions to be optimized by name (
`8891458`

) - Fixed a bug in the optimizer that failed to parse expressions containing nested function calls with zero parameters (such as
`min(pi())`

) (`4d33414`

)

- Implemented quotient rule of exponents (

- Added data type to the result.

- Bump lib
`muqsit/arithmexp`

to`0.1.21`

`Expression::getVariables()`

has been renamed to`Expression::findVariables()`

- Fixed a bug where exponentiation of
`2`

with itself resulted expression executing indefinitely

- Bump lib
`muqsit/arithmexp`

to`0.1.20`

- Fixed a bug causing operator strength reduction to not work on function calls with >2 arguments
- Use of same unary operator consecutively is now valid
- Operator strength reduction now optimizes unary positive and unary negative operations

- Bump lib
`muqsit/arithmexp`

to`0.1.19`

- Improved strength reduction over division operations
- Added a "commutative" property to functions
- min and max no longer throw an error when only 1 parameter is supplied
- Parser now attempts to catch division-by-zero during parsing

- Bump lib
`muqsit/arithmexp`

to`0.1.18`

- Fixed a bug causing non-deterministic function calls from being optimized away during parsing
- Argument underflow in function calls now throws a ParseException during parsing
- Added more constants (see List of pre defined constants)

- Bump lib
`muqsit/arithmexp`

to`0.1.17`

`BinaryOperators`

can now be checked for commutativity through`BinaryOperator::isCommutative()`

- Improved Operator Strength Reduction optimization by accounting for commutativity of binary operations

- Bump lib
`muqsit/arithmexp`

to`0.1.16`

- OSR now optimizes expressions such as
`x - x`

to`0`

- OSR now optimizes
`1 ** x`

to`1`

- Fixed parse errors arising from OSR not correctly building token tree
- Removed
`Parser::parseRawExpression()`

`Parser::createUnoptimized()->parse()`

may be used instead

- OSR now optimizes expressions such as

- Bump lib
`muqsit/arithmexp`

to`0.1.15`

- Added support for non-deterministic operators
- Added operator strength reduction optimization during parsing

- Initial version

This is the best calculator plugin it can calculate ANYTHING and also very large expression. And is is useful when you are developing custom pvp damage plugin on phone and don't want to switch to calculator app

I'll never say this again. This plugin updates too often. Someone stop the updates im boutto ðŸ’€

Reply to review by :

You can leave one review per plugin release, and delete or update your review at any time

Loading...