Browse Source

php: minor improvment to Math.exp

Franco Ponticelli 12 years ago
parent
commit
0ba992d34f
1 changed files with 4 additions and 4 deletions
  1. 4 4
      std/php/_std/Math.hx

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

@@ -34,12 +34,12 @@
 	public static function atan2(y : Float,x : Float) : Float  { return untyped __call__("atan2", y, x); }
 	public static function atan2(y : Float,x : Float) : Float  { return untyped __call__("atan2", y, x); }
 	public static function tan(v : Float) : Float      { return untyped __call__("tan", v); }
 	public static function tan(v : Float) : Float      { return untyped __call__("tan", v); }
 	public static function exp(v : Float) : Float      {
 	public static function exp(v : Float) : Float      {
-		if(v == POSITIVE_INFINITY)
+		if(untyped __call__("is_finite", v))
+			return untyped __call__("exp", v);
+		else if(v == POSITIVE_INFINITY)
 			return POSITIVE_INFINITY;
 			return POSITIVE_INFINITY;
-		else if(v == NEGATIVE_INFINITY)
-			return 0.0;
 		else
 		else
-			return untyped __call__("exp", v);
+			return 0.0;	
 	}
 	}
 	public static function log(v : Float) : Float      { return untyped __call__("log", v); }
 	public static function log(v : Float) : Float      { return untyped __call__("log", v); }
 	public static function sqrt(v : Float) : Float     { return untyped __call__("sqrt", v); }
 	public static function sqrt(v : Float) : Float     { return untyped __call__("sqrt", v); }