shithub: libmujs

Download patch

ref: ca79fc1497f30fc4f3bb9bcdc58490b1a93fc476
parent: 3a92e13e47b58c6416a9c5c2738a6ed96032c059
author: Tor Andersson <[email protected]>
date: Tue Jan 21 09:14:51 EST 2014

jsmath.c expanded

--- a/jsmath.c
+++ b/jsmath.c
@@ -2,53 +2,100 @@
 #include "jsvalue.h"
 #include "jsbuiltin.h"
 
-static int Math_abs(js_State *J, int argc) {
-	return js_pushnumber(J, abs(js_tonumber(J, 1))), 1;
+static int Math_abs(js_State *J, int argc)
+{
+	js_pushnumber(J, abs(js_tonumber(J, 1)));
+	return 1;
 }
-static int Math_acos(js_State *J, int argc) {
-	return js_pushnumber(J, acos(js_tonumber(J, 1))), 1;
+
+static int Math_acos(js_State *J, int argc)
+{
+	js_pushnumber(J, acos(js_tonumber(J, 1)));
+	return 1;
 }
-static int Math_asin(js_State *J, int argc) {
-	return js_pushnumber(J, asin(js_tonumber(J, 1))), 1;
+
+static int Math_asin(js_State *J, int argc)
+{
+	js_pushnumber(J, asin(js_tonumber(J, 1)));
+	return 1;
 }
-static int Math_atan(js_State *J, int argc) {
-	return js_pushnumber(J, atan(js_tonumber(J, 1))), 1;
+
+static int Math_atan(js_State *J, int argc)
+{
+	js_pushnumber(J, atan(js_tonumber(J, 1)));
+	return 1;
 }
-static int Math_atan2(js_State *J, int argc) {
-	return js_pushnumber(J, atan2(js_tonumber(J, 1), js_tonumber(J, 2))), 1;
+
+static int Math_atan2(js_State *J, int argc)
+{
+	js_pushnumber(J, atan2(js_tonumber(J, 1), js_tonumber(J, 2)));
+	return 1;
 }
-static int Math_ceil(js_State *J, int argc) {
-	return js_pushnumber(J, ceil(js_tonumber(J, 1))), 1;
+
+static int Math_ceil(js_State *J, int argc)
+{
+	js_pushnumber(J, ceil(js_tonumber(J, 1)));
+	return 1;
 }
-static int Math_cos(js_State *J, int argc) {
-	return js_pushnumber(J, cos(js_tonumber(J, 1))), 1;
+
+static int Math_cos(js_State *J, int argc)
+{
+	js_pushnumber(J, cos(js_tonumber(J, 1)));
+	return 1;
 }
-static int Math_exp(js_State *J, int argc) {
-	return js_pushnumber(J, exp(js_tonumber(J, 1))), 1;
+
+static int Math_exp(js_State *J, int argc)
+{
+	js_pushnumber(J, exp(js_tonumber(J, 1)));
+	return 1;
 }
-static int Math_floor(js_State *J, int argc) {
-	return js_pushnumber(J, floor(js_tonumber(J, 1))), 1;
+
+static int Math_floor(js_State *J, int argc)
+{
+	js_pushnumber(J, floor(js_tonumber(J, 1)));
+	return 1;
 }
-static int Math_log(js_State *J, int argc) {
-	return js_pushnumber(J, log(js_tonumber(J, 1))), 1;
+
+static int Math_log(js_State *J, int argc)
+{
+	js_pushnumber(J, log(js_tonumber(J, 1)));
+	return 1;
 }
-static int Math_pow(js_State *J, int argc) {
-	return js_pushnumber(J, pow(js_tonumber(J, 1), js_tonumber(J, 2))), 1;
+
+static int Math_pow(js_State *J, int argc)
+{
+	js_pushnumber(J, pow(js_tonumber(J, 1), js_tonumber(J, 2)));
+	return 1;
 }
-static int Math_random(js_State *J, int argc) {
-	return js_pushnumber(J, (double)rand() / (RAND_MAX - 1)), 1;
+
+static int Math_random(js_State *J, int argc)
+{
+	js_pushnumber(J, (double)rand() / (RAND_MAX - 1));
+	return 1;
 }
-static int Math_round(js_State *J, int argc) {
-	return js_pushnumber(J, round(js_tonumber(J, 1))), 1;
+
+static int Math_round(js_State *J, int argc)
+{
+	js_pushnumber(J, round(js_tonumber(J, 1)));
+	return 1;
 }
-static int Math_sin(js_State *J, int argc) {
-	return js_pushnumber(J, sin(js_tonumber(J, 1))), 1;
+
+static int Math_sin(js_State *J, int argc)
+{
+	js_pushnumber(J, sin(js_tonumber(J, 1)));
+	return 1;
 }
-static int Math_sqrt(js_State *J, int argc) {
-	return js_pushnumber(J, sqrt(js_tonumber(J, 1))), 1;
+
+static int Math_sqrt(js_State *J, int argc)
+{
+	js_pushnumber(J, sqrt(js_tonumber(J, 1)));
+	return 1;
 }
-static int Math_tan(js_State *J, int argc) {
-	return js_pushnumber(J, tan(js_tonumber(J, 1))), 1;
+
+static int Math_tan(js_State *J, int argc)
+{
+	js_pushnumber(J, tan(js_tonumber(J, 1)));
+	return 1;
 }
 
 static int Math_max(js_State *J, int argc)