forked from Mirror/wren
Added Num.atan(x)
Maps to the C function atan2.
This commit is contained in:
@ -20,6 +20,11 @@ The arc sine of the number.
|
||||
|
||||
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.
|
||||
|
||||
@ -380,7 +380,7 @@ DEF_PRIMITIVE(class_supertype)
|
||||
|
||||
// Object has no superclass.
|
||||
if (classObj->superclass == NULL) RETURN_NULL;
|
||||
|
||||
|
||||
RETURN_OBJ(classObj->superclass);
|
||||
}
|
||||
|
||||
@ -924,6 +924,11 @@ DEF_PRIMITIVE(num_atan)
|
||||
RETURN_NUM(atan(AS_NUM(args[0])));
|
||||
}
|
||||
|
||||
DEF_PRIMITIVE(num_atan2)
|
||||
{
|
||||
RETURN_NUM(atan2(AS_NUM(args[0]), AS_NUM(args[1])));
|
||||
}
|
||||
|
||||
DEF_PRIMITIVE(num_ceil)
|
||||
{
|
||||
RETURN_NUM(ceil(AS_NUM(args[0])));
|
||||
@ -1609,6 +1614,7 @@ void wrenInitializeCore(WrenVM* vm)
|
||||
PRIMITIVE(vm->numClass, "acos", num_acos);
|
||||
PRIMITIVE(vm->numClass, "asin", num_asin);
|
||||
PRIMITIVE(vm->numClass, "atan", num_atan);
|
||||
PRIMITIVE(vm->numClass, "atan(_)", num_atan2);
|
||||
PRIMITIVE(vm->numClass, "ceil", num_ceil);
|
||||
PRIMITIVE(vm->numClass, "cos", num_cos);
|
||||
PRIMITIVE(vm->numClass, "floor", num_floor);
|
||||
|
||||
Reference in New Issue
Block a user