diff --git a/src/public/value/number.rs b/src/public/value/number.rs index 1fabe3f..e586e77 100644 --- a/src/public/value/number.rs +++ b/src/public/value/number.rs @@ -33,6 +33,7 @@ impl Number { } match (dividend, divisor) { + (Self::Int(i1), Self::Int(i2)) => Number::Int(i1 % i2), (Self::Int(i), Self::Fraction(upper, lower)) | (Self::Fraction(upper, lower), Self::Int(i)) => { let temp1 = i * lower; let temp2 = upper * lower; diff --git "a/tutorials/CN/\350\257\255\346\263\225\346\225\231\347\250\213/operators.calcrs" "b/tutorials/CN/\350\257\255\346\263\225\346\225\231\347\250\213/operators.calcrs" index 0951d12..8711f78 100644 --- "a/tutorials/CN/\350\257\255\346\263\225\346\225\231\347\250\213/operators.calcrs" +++ "b/tutorials/CN/\350\257\255\346\263\225\346\225\231\347\250\213/operators.calcrs" @@ -3,6 +3,10 @@ out 1 + 2 # 3 out 1 - 2 # -1 out 1 * 2 # 2 out 1 / 2 # 0.5000000000 + +# 模运算 +out 8 % 2 # 0 +# 乘方运算 out 2 ^ 2 # 4 # 非操作符 diff --git a/tutorials/EN/syntax/operators.calcrs b/tutorials/EN/syntax/operators.calcrs index 287c5f7..c84d582 100644 --- a/tutorials/EN/syntax/operators.calcrs +++ b/tutorials/EN/syntax/operators.calcrs @@ -3,6 +3,10 @@ out 1 + 2 # 3 out 1 - 2 # -1 out 1 * 2 # 2 out 1 / 2 # 0.5000000000 + +# modular operator +out 8 % 2 # 0 +# power operator out 2 ^ 2 # 4 # not operator