diff core/src/luan/impl/ModExpr.java @ 446:bbad2d06f728

remove automatic conversion from string to number
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 04 May 2015 16:21:17 -0600
parents 6e11eace1091
children b48cfa14ba60
line wrap: on
line diff
--- a/core/src/luan/impl/ModExpr.java	Mon May 04 15:43:36 2015 -0600
+++ b/core/src/luan/impl/ModExpr.java	Mon May 04 16:21:17 2015 -0600
@@ -1,6 +1,5 @@
 package luan.impl;
 
-import luan.Luan;
 import luan.LuanException;
 import luan.LuanSource;
 
@@ -14,11 +13,9 @@
 	@Override public Object eval(LuanStateImpl luan) throws LuanException {
 		Object o1 = op1.eval(luan);
 		Object o2 = op2.eval(luan);
-		Number n1 = Luan.toNumber(o1);
-		Number n2 = Luan.toNumber(o2);
-		if( n1 != null && n2 != null ) {
-			double d1 = n1.doubleValue();
-			double d2 = n2.doubleValue();
+		if( o1 instanceof Number && o2 instanceof Number ) {
+			double d1 = ((Number)o1).doubleValue();
+			double d2 = ((Number)o2).doubleValue();
 			return d1 - Math.floor(d1/d2)*d2;
 		}
 		return arithmetic(luan,"__mod",o1,o2);