mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-11 22:28:45 +01:00
Added Num.tan
Strange omission with Num.sin and Num.cos already available.
This commit is contained in:
@ -42,6 +42,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.
|
||||
|
||||
@ -962,6 +962,11 @@ DEF_PRIMITIVE(num_sqrt)
|
||||
RETURN_NUM(sqrt(AS_NUM(args[0])));
|
||||
}
|
||||
|
||||
DEF_PRIMITIVE(num_tan)
|
||||
{
|
||||
RETURN_NUM(tan(AS_NUM(args[0])));
|
||||
}
|
||||
|
||||
DEF_PRIMITIVE(num_toString)
|
||||
{
|
||||
double value = AS_NUM(args[0]);
|
||||
@ -1594,6 +1599,7 @@ void wrenInitializeCore(WrenVM* vm)
|
||||
PRIMITIVE(vm->numClass, "sign", num_sign);
|
||||
PRIMITIVE(vm->numClass, "sin", num_sin);
|
||||
PRIMITIVE(vm->numClass, "sqrt", num_sqrt);
|
||||
PRIMITIVE(vm->numClass, "tan", num_tan);
|
||||
PRIMITIVE(vm->numClass, "toString", num_toString);
|
||||
PRIMITIVE(vm->numClass, "truncate", num_truncate);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user