WebCore Compiler Error

If I specify a constant with a small value (say 1e-6) the value comes out as 1e-7. I know you don't believe me. Frankly I don't believe me .... but here is a demo project to show this. On a new WebCore application I added a few labels and a button and then defined a constant and showed the constant and some calculations using it. See code snippet below:

Form1: TForm1;

SmallConstant = 1e-6;


{$R *.dfm}

procedure TForm1.btn_ShowResultsClick(Sender: TObject);
var val : Double;
l_ReadValue.Caption := Format('%g',[SmallConstant]);
l_CalcedVal.Caption := Format('%g',[SmallConstant*1000000]);
val := SmallConstant;
l_ValValue.Caption := FloatToStr(val);

And the results:

Mark [We have a site license but only one login]

Looks like a pas2js compiler bug.
We'll report it to the pas2js team. Thanks.

14. compiling issue.zip (1.5 MB)

We investigated this further and found it only has the issue when the constant is set to 1e-6. On the other hand, if we set a variable and assign value 1e-6 to the variable, and it also has no issue.

We also attached a demo project if you would like to take a look.

pas2js team already fixed the compiler.
This updated compiler will be in the TMS WEB Core v2.1 release.

Thanks Bruno.

Hey Bruno, a quick question, any idea when version 2.1 will be released? thanks!~

We're working extremely hard on getting everything finished asap.
This week or next week.

Thanks Bruno for the time and effort! We tested it on 2.1 and it works well.

1 Like