Fix 1e parsing
Fix 1e5, 1e-5 evaluated as Infinity (https://github.com/HaxeFoundation/hscript/pull/132)
This commit is contained in:
@@ -33,6 +33,10 @@ class TestHScript extends TestCase {
|
||||
assertScript("- 123",-123);
|
||||
assertScript("1.546",1.546);
|
||||
assertScript(".545",.545);
|
||||
assertScript("1e5",100000);
|
||||
assertScript("1.2e2",120);
|
||||
assertScript("100e-2",1);
|
||||
assertScript("1.2e-1",0.12);
|
||||
assertScript("'bla'","bla");
|
||||
assertScript("null",null);
|
||||
assertScript("true",true);
|
||||
|
||||
@@ -1943,6 +1943,8 @@ class Parser {
|
||||
}
|
||||
if( pow == null )
|
||||
invalidChar(char);
|
||||
if( exp == 0 )
|
||||
exp = 10;
|
||||
return TConst(CFloat((Math.pow(10, pow) / exp) * n * 10));
|
||||
case ".".code:
|
||||
if( exp > 0 ) {
|
||||
|
||||
Reference in New Issue
Block a user