mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-10 21:58:48 +01:00
core; num; add exp & log2
I've had a couple use cases in time that the code is significantly clearer with these, and makes porting less error prone
This commit is contained in:
3
test/core/number/exp.wren
Normal file
3
test/core/number/exp.wren
Normal file
@ -0,0 +1,3 @@
|
||||
System.print(5.exp) // expect: 148.41315910258
|
||||
System.print(10.exp) // expect: 22026.465794807
|
||||
System.print((-1).exp) // expect: 0.36787944117144
|
||||
4
test/core/number/log2.wren
Normal file
4
test/core/number/log2.wren
Normal file
@ -0,0 +1,4 @@
|
||||
System.print(1024.log2) // expect: 10
|
||||
System.print(2048.log2) // expect: 11
|
||||
System.print(100.log2) // expect: 6.6438561897747
|
||||
System.print((-1).log2) // expect: nan
|
||||
Reference in New Issue
Block a user