aboutsummaryrefslogtreecommitdiff
path: root/src/lib_math.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib_math.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/lib_math.c b/src/lib_math.c
index fad1c284..f90dd331 100644
--- a/src/lib_math.c
+++ b/src/lib_math.c
@@ -47,12 +47,6 @@ LJLIB_ASM_(math_tanh) LJLIB_REC(math_htrig IRCALL_tanh)
47LJLIB_ASM_(math_frexp) 47LJLIB_ASM_(math_frexp)
48LJLIB_ASM_(math_modf) LJLIB_REC(.) 48LJLIB_ASM_(math_modf) LJLIB_REC(.)
49 49
50LJLIB_PUSH(57.29577951308232)
51LJLIB_ASM_(math_deg) LJLIB_REC(math_degrad)
52
53LJLIB_PUSH(0.017453292519943295)
54LJLIB_ASM_(math_rad) LJLIB_REC(math_degrad)
55
56LJLIB_ASM(math_log) LJLIB_REC(math_log) 50LJLIB_ASM(math_log) LJLIB_REC(math_log)
57{ 51{
58 double x = lj_lib_checknum(L, 1); 52 double x = lj_lib_checknum(L, 1);
@@ -63,12 +57,15 @@ LJLIB_ASM(math_log) LJLIB_REC(math_log)
63#else 57#else
64 x = lj_vm_log2(x); y = 1.0 / lj_vm_log2(y); 58 x = lj_vm_log2(x); y = 1.0 / lj_vm_log2(y);
65#endif 59#endif
66 setnumV(L->base-1, x*y); /* Do NOT join the expression to x / y. */ 60 setnumV(L->base-1-LJ_FR2, x*y); /* Do NOT join the expression to x / y. */
67 return FFH_RES(1); 61 return FFH_RES(1);
68 } 62 }
69 return FFH_RETRY; 63 return FFH_RETRY;
70} 64}
71 65
66LJLIB_LUA(math_deg) /* function(x) return x * 57.29577951308232 end */
67LJLIB_LUA(math_rad) /* function(x) return x * 0.017453292519943295 end */
68
72LJLIB_ASM(math_atan2) LJLIB_REC(.) 69LJLIB_ASM(math_atan2) LJLIB_REC(.)
73{ 70{
74 lj_lib_checknum(L, 1); 71 lj_lib_checknum(L, 1);