Переглянути джерело

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> {