Fix math.fmod for int values.
This commit is contained in:
@@ -163,10 +163,12 @@ public class MathLib extends TwoArgFunction {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static final class fmod extends BinaryOp {
|
static final class fmod extends TwoArgFunction {
|
||||||
protected double call(double x, double y) {
|
public LuaValue call(LuaValue xv, LuaValue yv) {
|
||||||
double q = x/y;
|
if (xv.islong() && yv.islong()) {
|
||||||
return x - y * (q>=0? Math.floor(q): Math.ceil(q));
|
return valueOf(xv.tolong() % yv.tolong());
|
||||||
|
}
|
||||||
|
return valueOf(xv.checkdouble() % yv.checkdouble());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static final class ldexp extends BinaryOp {
|
static final class ldexp extends BinaryOp {
|
||||||
|
|||||||
Reference in New Issue
Block a user