Handle rhs of zero for operation fmod

This commit is contained in:
Enrico Horn
2021-07-11 22:50:29 +02:00
parent 5851e6994a
commit b121b65151

View File

@@ -231,6 +231,8 @@ public class MathLib extends TwoArgFunction {
static final class fmod extends TwoArgFunction {
@Override
public LuaValue call(LuaValue xv, LuaValue yv) {
if (yv.checkdouble() == 0.0d)
return LuaDouble.NAN;
if (xv.islong() && yv.islong()) {
return valueOf(xv.tolong()%yv.tolong());
}