roll-parser - v3.4.0
    Preparing search index...

    Type Alias BinaryOpNode

    BinaryOpNode: NodeSpan & {
        left: ASTNode;
        operator: "+" | "-" | "*" | "/" | "%" | "**";
        right: ASTNode;
        type: "BinaryOp";
    }

    Binary operation node — the arithmetic backbone of an expression.

    Operator Meaning Precedence Associativity
    + - add, subtract 10 left
    * / % multiply, divide, modulo 20 left
    ** power (also spelled ^) 30 right

    Dice bind tighter than all of them (40), and postfix modifiers sit at 35, so 2d6+3 is (2d6)+3 and 4d6kh3*2 is (4d6kh3)*2. The vs operator binds loosest of all (2) and has its own VersusNode.

    / and % throw DIVISION_BY_ZERO / MODULO_BY_ZERO on a zero right side; any operator producing a non-finite total throws NON_FINITE_RESULT. Division is not rounded — wrap it in floor() if you need an integer.