summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-04-11 22:45:57 +0300
committerPaul Buetow <paul@buetow.org>2026-04-11 22:45:57 +0300
commitfe31559af818bcc1771b1a2eafc7f3aa1cac3f75 (patch)
tree192545c30e748de5a8bc96bf7d116e5971ee15f7 /README.md
parenta1a55e2f1702b9f0f95ec10d3d9adcf35999f006 (diff)
feat: implement binary exponentiation with ** operator
- Add PowInt(int) method to Number interface - Implement binary exponentiation for Float and Rat types - Add FastPower operator to handle ** operator - Register ** operator in NewOperatorRegistry - Add unit tests for PowInt (basic, large, negative exponents) - Add integration tests for ** operator (CLI and stdin) - Update README.md with ** operator documentation
Diffstat (limited to 'README.md')
-rw-r--r--README.md13
1 files changed, 12 insertions, 1 deletions
diff --git a/README.md b/README.md
index ef97fdd..b722ddc 100644
--- a/README.md
+++ b/README.md
@@ -83,16 +83,27 @@ gt '5 6 *' # 5 * 6 = 30
gt '20 4 /' # 20 / 4 = 5
# → 5
-gt '2 3 ^' # 2^3 = 8
+gt '2 3 ^' # 2^3 = 8 (floating-point power)
# → 8
gt '2 10 **' # 2^10 = 1024 (Fast binary exponentiation)
# → 1024
+gt '2 -3 **' # 2^(-3) = 0.125 (negative integer exponent)
+# → 0.125
+
+gt '5 0 **' # 5^0 = 1 (zero exponent)
+# → 1
+
+gt '10 100 **' # 10^100 (very large exponent - efficient)
+# → 1e+100
+
gt '10 3 %' # 10 % 3 = 1 (modulo)
# → 1
```
+**Note:** The `**` operator uses binary exponentiation (exponentiation by squaring), which is more efficient than the general `^` operator for large integer exponents. It only works with integer exponents.
+
#### Expression Chaining
```bash