浏览代码

correct Math.round and Std.int to EcmaScript and Haxe spec

PeyTy 10 年之前
父节点
当前提交
5fed046554
共有 2 个文件被更改,包括 1 次插入3 次删除
  1. 0 2
      std/lua/_std/Math.hx
  2. 1 1
      std/lua/_std/Std.hx

+ 0 - 2
std/lua/_std/Math.hx

@@ -67,8 +67,6 @@ class Math
 	public static inline function fceil( v : Float ) : Float return ceil(v);
 	public static inline function fround( v : Float ) : Float return round(v);
 
-
-
 	static function __init__() : Void {
 		untyped __feature__("Type.resolveClass", _hxClasses["Math"] = Math);
 	}

+ 1 - 1
std/lua/_std/Std.hx

@@ -38,7 +38,7 @@ import lua.Boot;
 	}
 
 	public static inline function int( x : Float ) : Int {
-		return Math.floor(x + .5); 
+		return x > 0 ? Math.floor(x) : Math.ceil(x);
 	}
 
 	public static function parseInt( x : String ) : Null<Int> {