Browse Source

[java/cs] Correctly handle .0X on Std.parseFloat. Closes #3742

Cauê Waneck 10 years ago
parent
commit
5834b9ab1a
3 changed files with 12 additions and 0 deletions
  1. 1 0
      std/cs/_std/Std.hx
  2. 1 0
      std/java/_std/Std.hx
  3. 10 0
      tests/unit/src/unit/issues/Issue3742.hx

+ 1 - 0
std/cs/_std/Std.hx

@@ -165,6 +165,7 @@ import cs.internal.Exceptions;
 				if (div != 0.0)
 					break;
 				div = 1.0;
+				foundAny = true;
 
 				continue;
 			}

+ 1 - 0
std/java/_std/Std.hx

@@ -170,6 +170,7 @@ import java.internal.Exceptions;
 				if (div != 0.0)
 					break;
 				div = 1.0;
+				foundAny = true;
 
 				continue;
 			}

+ 10 - 0
tests/unit/src/unit/issues/Issue3742.hx

@@ -0,0 +1,10 @@
+package unit.issues;
+
+class Issue3742 extends Test {
+	function test() {
+		eq( Std.parseFloat(".05"), .05 );
+		eq( Std.parseFloat(".005"), .005 );
+		eq( Std.parseFloat(".5"), .5 );
+	}
+}
+