From 26ddc2b1263146599d617e8dc877346001684ef6 Mon Sep 17 00:00:00 2001 From: Massimo Melina Date: Tue, 16 Jun 2020 23:14:45 +0200 Subject: [PATCH] fix: {.calc.} not working with very small numbers (because rendered with exponential syntax) --- scriptLib.pas | 5 +---- utillib.pas | 4 +++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/scriptLib.pas b/scriptLib.pas index 2adc95d..1be38c0 100644 --- a/scriptLib.pas +++ b/scriptLib.pas @@ -1962,10 +1962,7 @@ try begin try if isFalse(parEx('if')) then - begin - result:=''; - exit; - end; + exit(''); except end; result:=md.cd.disconnectReason; // return the previous state if pars.count > 0 then md.cd.disconnectReason:=p; diff --git a/utillib.pas b/utillib.pas index 936b36e..dda375b 100644 --- a/utillib.pas +++ b/utillib.pas @@ -2576,7 +2576,8 @@ var i:=mImp+dir; repeat j:=i+dir; - if (j > 0) and (j <= length(s)) and charInSet(s[j], ['0'..'9','.']) then + if (j > 0) and (j <= length(s)) + and (charInSet(s[j], ['0'..'9','.','E']) or (j>1) and charInSet(s[j],['+','-']) and (s[j-1]='E')) then i:=j else break; @@ -2606,6 +2607,7 @@ begin end; if (i = 1) // a starting operator is not an operator + or (s[i-1]='E') // exponential syntax or (v <= mImpV) // left-to-right precedence then continue; // we got a better one, record it