fix: {.calc.} not working with very small numbers (because rendered with exponential syntax)

This commit is contained in:
Massimo Melina 2020-06-16 23:14:45 +02:00
parent 65d4a142e4
commit 26ddc2b126
2 changed files with 4 additions and 5 deletions

View File

@ -1962,10 +1962,7 @@ try
begin begin
try try
if isFalse(parEx('if')) then if isFalse(parEx('if')) then
begin exit('');
result:='';
exit;
end;
except end; except end;
result:=md.cd.disconnectReason; // return the previous state result:=md.cd.disconnectReason; // return the previous state
if pars.count > 0 then md.cd.disconnectReason:=p; if pars.count > 0 then md.cd.disconnectReason:=p;

View File

@ -2576,7 +2576,8 @@ var
i:=mImp+dir; i:=mImp+dir;
repeat repeat
j:=i+dir; 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 i:=j
else else
break; break;
@ -2606,6 +2607,7 @@ begin
end; end;
if (i = 1) // a starting operator is not an operator if (i = 1) // a starting operator is not an operator
or (s[i-1]='E') // exponential syntax
or (v <= mImpV) // left-to-right precedence or (v <= mImpV) // left-to-right precedence
then continue; then continue;
// we got a better one, record it // we got a better one, record it