Added Num.tan

Strange omission with Num.sin and Num.cos already available.
This commit is contained in:
Thorbjørn Lindeijer
2015-03-14 14:40:23 +01:00
parent 92c17e81f6
commit 09bcf5ad98
2 changed files with 10 additions and 0 deletions

View File

@ -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.

View File

@ -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);