Skip to content

Commit abb3aaf

Browse files
committed
add modulo operation to arithmetic block
1 parent 747b16a commit abb3aaf

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

app/blocks/math/arithmetic.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export default {
3131
['-', 'MINUS', "Subtraction: Remove B from A (e.g., 30 - 5 = 25). For calculating differences, finding deltas between readings, or subtracting baseline values."],
3232
['x', 'MULTIPLY', "Multiplication: A times B (e.g., 6 x 4 = 24). For unit conversions, scaling values, calculating areas/volumes, or applying multiplication factors."],
3333
['/', 'DIVIDE', "Division: A divided by B (e.g., 20 ÷ 4 = 5). For calculating averages, ratios, percentages, or converting between different unit scales."],
34+
['%', 'MODULO', "Modulo: The remainder of A divided by B (e.g., 5 % 2 = 1). For determining if one number divides evenly by another, or working with the remainder directly."],
3435
['^', 'POWER', "Exponentiation: A raised to the power of B (e.g., 2^3 = 8). For advanced calculations, exponential growth models, or complex mathematical formulas."],
3536
]
3637
}
@@ -43,6 +44,7 @@ export default {
4344
MINUS: '-',
4445
MULTIPLY: '*',
4546
DIVIDE: '/',
47+
MODULO: '%',
4648
POWER: '^'
4749
},
4850
operator = block.getFieldValue('OP'),
@@ -69,6 +71,7 @@ export default {
6971
'-': 'MINUS',
7072
'*': 'MULTIPLY',
7173
'/': 'DIVIDE',
74+
'%': 'MODULO',
7275
'^': 'POWER',
7376
},
7477
fields = {

0 commit comments

Comments
 (0)