Convert mathlib.modf result to number
This commit is contained in:
@@ -300,7 +300,7 @@ public class MathLib extends TwoArgFunction {
|
|||||||
LuaValue n = args.arg1();
|
LuaValue n = args.arg1();
|
||||||
/* number is its own integer part, no fractional part */
|
/* number is its own integer part, no fractional part */
|
||||||
if (n.islong())
|
if (n.islong())
|
||||||
return varargsOf(n, valueOf(0.0));
|
return varargsOf(n.tonumber(), valueOf(0.0));
|
||||||
double x = n.checkdouble();
|
double x = n.checkdouble();
|
||||||
/* integer part (rounds toward zero) */
|
/* integer part (rounds toward zero) */
|
||||||
double intPart = x > 0? Math.floor(x): Math.ceil(x);
|
double intPart = x > 0? Math.floor(x): Math.ceil(x);
|
||||||
|
|||||||
Reference in New Issue
Block a user