feat: add trigonometric methods and Num.pi constant to core library

Add acos, asin, atan, atan2, tan methods to Num class and expose Num.pi constant with value π. Include corresponding C primitives in wren_core.c and test files for each new method.
This commit is contained in:
Bob Nystrom
2015-03-21 19:54:08 +00:00
9 changed files with 87 additions and 0 deletions
+24
View File
@@ -8,6 +8,23 @@ The absolute value of the number.
:::dart
-123.abs // 123
### **acos**
The arc cosine of the number.
### **asin**
The arc sine of the number.
### **atan**
The arc tangent of the number.
### **atan**(x)
The arc tangent of the number when divided by `x`, using the signs of the two
numbers to determine the quadrant of the result.
### **ceil**
Rounds the number up to the nearest integer.
@@ -42,6 +59,10 @@ The sine of the number.
The square root of the number. Returns `nan` if the number is negative.
### **tan**
The tangent of the number.
### **-** operator
Negates the number.
@@ -118,3 +139,6 @@ Attempts to parse `value` as a decimal literal and return it as an instance of
It is a runtime error if `value` is not a string.
### Num.**pi**
The value of π.