Răsfoiți Sursa

php: fixed Math specification

Franco Ponticelli 12 ani în urmă
părinte
comite
bbe822938b
2 a modificat fișierele cu 14 adăugiri și 2 ștergeri
  1. 12 0
      std/php/Boot.hx
  2. 2 2
      std/php/_std/Math.hx

+ 12 - 0
std/php/Boot.hx

@@ -487,6 +487,18 @@ class _hx_list_iterator implements Iterator {
 	}
 }
 
+function _hx_max($a, $b) {
+	if(is_nan($a) || is_nan($b))
+		return Math::$NaN;
+	return max($a, $b);
+}
+
+function _hx_min($a, $b) {
+	if(is_nan($a) || is_nan($b))
+		return Math::$NaN;
+	return min($a, $b);
+}
+
 function _hx_null() { return null; }
 
 class _hx_nullob {

+ 2 - 2
std/php/_std/Math.hx

@@ -27,8 +27,8 @@
 	public static var NEGATIVE_INFINITY(default,null) : Float;
 
 	public static function abs(v : Float) : Float      { return untyped __call__("abs", v); }
-	public static function min(a : Float,b : Float) : Float    { return untyped __call__("min", a, b); }
-	public static function max(a : Float,b : Float) : Float    { return untyped __call__("max", a, b); }
+	public static function min(a : Float,b : Float) : Float    { return untyped __call__("_hx_min", a, b); }
+	public static function max(a : Float,b : Float) : Float    { return untyped __call__("_hx_max", a, b); }
 	public static function sin(v : Float) : Float      { return untyped __call__("sin", v); }
 	public static function cos(v : Float) : Float      { return untyped __call__("cos", v); }
 	public static function atan2(y : Float,x : Float) : Float  { return untyped __call__("atan2", y, x); }