Browse Source

[cs] fix parsing of sign after E in Std.parseFloat (see #4051)

Dan Korostelev 10 years ago
parent
commit
a66fb549a4
1 changed files with 3 additions and 3 deletions
  1. 3 3
      std/cs/_std/Std.hx

+ 3 - 3
std/cs/_std/Std.hx

@@ -134,7 +134,7 @@ import cs.internal.Exceptions;
 	public static function parseFloat( x : String ) : Float {
 		if (x == null) return Math.NaN;
 		x = StringTools.ltrim(x);
-		var found = false, isHex = false, hasDot = false, hasE = false, hasNeg = false, hasENeg = false;
+		var found = false, isHex = false, hasDot = false, hasE = false, hasNeg = false, hasESign = false;
 		var i = -1;
 		inline function getch(i:Int):Int return cast ((untyped x : cs.system.String)[i]);
 
@@ -163,8 +163,8 @@ import cs.internal.Exceptions;
 					hasDot = true;
 				case '-'.code if (!found && !hasNeg):
 					hasNeg = true;
-				case '-'.code if (found && !hasENeg && hasE):
-					hasENeg = true;
+				case '-'.code | '+'.code if (found && !hasESign && hasE):
+					hasESign = true;
 				case _:
 					break;
 			}