Skip to content

Commit 26ddc2b

Browse files
committed
fix: {.calc.} not working with very small numbers (because rendered with exponential syntax)
1 parent 65d4a14 commit 26ddc2b

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

scriptLib.pas

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1962,10 +1962,7 @@ function cbMacros(fullMacro:string; pars:Tstrings; cbData:pointer):string;
19621962
begin
19631963
try
19641964
if isFalse(parEx('if')) then
1965-
begin
1966-
result:='';
1967-
exit;
1968-
end;
1965+
exit('');
19691966
except end;
19701967
result:=md.cd.disconnectReason; // return the previous state
19711968
if pars.count > 0 then md.cd.disconnectReason:=p;

utillib.pas

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2576,7 +2576,8 @@ function evalFormula(s:string):real;
25762576
i:=mImp+dir;
25772577
repeat
25782578
j:=i+dir;
2579-
if (j > 0) and (j <= length(s)) and charInSet(s[j], ['0'..'9','.']) then
2579+
if (j > 0) and (j <= length(s))
2580+
and (charInSet(s[j], ['0'..'9','.','E']) or (j>1) and charInSet(s[j],['+','-']) and (s[j-1]='E')) then
25802581
i:=j
25812582
else
25822583
break;
@@ -2606,6 +2607,7 @@ function evalFormula(s:string):real;
26062607
end;
26072608

26082609
if (i = 1) // a starting operator is not an operator
2610+
or (s[i-1]='E') // exponential syntax
26092611
or (v <= mImpV) // left-to-right precedence
26102612
then continue;
26112613
// we got a better one, record it

0 commit comments

Comments
 (0)