feat: add log and pow methods to Num class with tests

Adds `log` method to Num class via DEF_NUM_FN macro, and `pow(_)` method via a new DEF_PRIMITIVE that calls C's `pow()`. Registers both primitives in wrenInitializeCore. Includes new test files `test/core/number/log.wren` and `test/core/number/pow.wren` covering basic cases and edge values (negative input for log, zero exponent for pow). Also adds Sven Bergström to AUTHORS.
This commit is contained in:
Bob Nystrom
2017-01-20 15:20:55 +00:00
4 changed files with 16 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
System.print(3.log) // expect: 1.0986122886681
System.print(100.log) // expect: 4.6051701859881
System.print((-1).log) // expect: nan
+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