Convert mathlib.modf result to number

This commit is contained in:
Enrico Horn
2021-07-21 23:59:42 +02:00
parent abe14ca995
commit 66130964c6

View File

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