feat: add pow(_) primitive to Num class for exponentiation

Implement the `num_pow` primitive that wraps C's `pow()` function, enabling
exponentiation on Num instances via the `pow(_)` method. Register the new
primitive in `wrenInitializeCore` and add a test file verifying basic cases:
2^4=16, 2^10=1024, and 1^0=1.
This commit is contained in:
underscorediscovery
2016-10-31 19:52:13 +00:00
parent 84a14cde08
commit 8b9f99663b
2 changed files with 10 additions and 0 deletions
+4
View File
@@ -0,0 +1,4 @@
System.print(2.pow(4)) // expect: 16
System.print(2.pow(10)) // expect: 1024
System.print(1.pow(0)) // expect: 1