Bug: round function causes compile error.

Moderator: Benj

Post Reply
User avatar
AbhijitR
Posts: 300
Joined: Fri Nov 07, 2014 12:48 pm
Location: Pune, India
Has thanked: 283 times
Been thanked: 80 times

Bug: round function causes compile error.

Post by AbhijitR »

Hello! Martin

Following the post regarding rounding a real number, everything worked well on the 19th of March, I mean compilation and running on the hardware, after that day I was not able to work on the project due to crises, today when I opened the project I received the popup for updates, as usual I did the complete update and restart FC.

Now I am receiving an error report when I compile (the same chart without any changes) and the error points out to

19477: FCV_DIFF_PRES_VAL_CAL_REAL = {(long)(if (FCV_DIFF_PRES_VAL_CAL_REAL >= 0.0)(FCV_DIFF_PRES_VAL_CAL_REAL) + 0.5; else (FCV_DIFF_PRES_VAL_CAL_REAL) - 0.5)};

If I have not mistaken this is regarding the rounding function, after I disabled all the rounding functions at all the four different locations and compiled with success. Is this something to do with todays update? can you suggest where it is going wrong? can I uninstall todays updates and validate? so many doubts....

Thank you.

Regards
Abhi

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: Division by 10 easy?

Post by medelec35 »

I have updated my version to the latest.
Can you post the flowchart, so I can see if it compiles for me or not?
Martin

User avatar
AbhijitR
Posts: 300
Joined: Fri Nov 07, 2014 12:48 pm
Location: Pune, India
Has thanked: 283 times
Been thanked: 80 times

Re: Division by 10 easy?

Post by AbhijitR »

Hi!

Thanks for the reply, I have attached a part of the FC, the calculation block in the beginning of the loop if you disable the round off line it compile well on my machine.

Hear you soon.

Abhi
Attachments
LPTR_28-03-2020_Martin.fcfx
(42 KiB) Downloaded 283 times

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: Division by 10 easy?

Post by medelec35 »

It does look like there is an issue with the

Code: Select all

round
function
What about replacing the

Code: Select all

round
with

Code: Select all

ceil
?
So you have

Code: Select all

Diff_Pres_Val_Cal_Real = ceil (Diff_Pres_Val_Cal_Real)
Martin

User avatar
AbhijitR
Posts: 300
Joined: Fri Nov 07, 2014 12:48 pm
Location: Pune, India
Has thanked: 283 times
Been thanked: 80 times

Re: Division by 10 easy?

Post by AbhijitR »

Hello! Martin
good morning
medelec35 wrote: with

Code: Select all

ceil
?
You are a genius, I don't know the trick but the term/word "ceil" did it, now the chart compile with success.

Thank you again, do take care, stay safe.

Regards
Abhi

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: Division by 10 easy?

Post by medelec35 »

You're welcome.
Even though project now compiles, are you getting required results with your hardware?
Martin

User avatar
AbhijitR
Posts: 300
Joined: Fri Nov 07, 2014 12:48 pm
Location: Pune, India
Has thanked: 283 times
Been thanked: 80 times

Re: Division by 10 easy?

Post by AbhijitR »

Hi!
medelec35 wrote: Even though project now compiles, are you getting required results with your hardware?
Yes you are again right Martin, no doubt the chart compile but the function is not rounding the figures as it should, what can be done? any idea.

Thank you.

Abhi

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: Division by 10 easy?

Post by medelec35 »

Until the bug is fixed.
Can you try the attache flowchart on your hardware?
I have split the topic and moved to the bugs section.
Attachments
LPTR_28-03-2020_Martin2.fcfx
(42.7 KiB) Downloaded 287 times
Martin

User avatar
AbhijitR
Posts: 300
Joined: Fri Nov 07, 2014 12:48 pm
Location: Pune, India
Has thanked: 283 times
Been thanked: 80 times

Re: Bug: round function causes compile error.

Post by AbhijitR »

Hello! Martin

Thanks for taking the correct action.

I tried to run the chart which you last posted, it opened but with one warning about created in new version, so I uninstalled the old version and download the version 8.2 (the big download button) and installed, I also tried to install the patch file and hotfix but received one more error from windows installer so I let it for the moment.

Now I am able to open the recent chart which you posted but unfortunately it do not round off for e.g. 38.25 to 38 but it will round off to 39

I hope someone from Matrix team will also check about the round off function not working or may be I am doing some mistake.

Thank you very much again, hear you soon.

Abhi
Attachments
Version8.2.PNG
(31.54 KiB) Downloaded 477 times
My_Present_FC8_Version_30-03-2020.PNG
(117.59 KiB) Downloaded 477 times
Error_Window_Patch_File.PNG
(14.27 KiB) Downloaded 477 times

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times

Re: Bug: round function causes compile error.

Post by LeighM »

Hi Abhi,
Please try the attached to go into
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC
Attachments
PIC_CAL_Float.c
(6.44 KiB) Downloaded 272 times

User avatar
AbhijitR
Posts: 300
Joined: Fri Nov 07, 2014 12:48 pm
Location: Pune, India
Has thanked: 283 times
Been thanked: 80 times

Re: Bug: round function causes compile error.

Post by AbhijitR »

Hi! Leigh

Thank you to address this problem quickly, as per your instructions I deleted the existing *.c file and paste the one you posted, restart FC, compile successfully and run on the hardware too now the rounding function works like before, I will take some more trials and keep you posted but I am sure it works like before.

Thank you to Martin too for creating the new post.

Take care, stay safe.

Abhi

User avatar
AbhijitR
Posts: 300
Joined: Fri Nov 07, 2014 12:48 pm
Location: Pune, India
Has thanked: 283 times
Been thanked: 80 times

Re: Bug: round function causes compile error.

Post by AbhijitR »

Hello! Leigh
good morning

Following your last post regarding replacing the PIC_CAL_Float.c notepad file from the C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC location with the notepad file which you provided in that post, everything works well i.e. simulation, compilation and also hardware.

But once I open the same chart again fresh, I am prompted to install the new updates, after completing the update process, same compilation error occurs again. I again followed the same process of deleting and replacing, everything works well.

I tried to compare both the notepad files, the one you gave and the one which I receive after update, there is some difference, I have attached the comparison for your reference, the one highlighted in red is your notepad file and the one in green is from the update. To be honest I do not understand what is the difference (not my cup of tea), :(

Today morning I was again prompted to update but I have skipped the same for the moment, I will do that once the file in update is corrected.

Thank you, hear you soon.

Abhi
Attachments
Update_Prompt_31-03-2020.PNG
(13.36 KiB) Downloaded 446 times
Notepad compair.PNG
(38.88 KiB) Downloaded 446 times

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times

Re: Bug: round function causes compile error.

Post by LeighM »

I have skipped the same for the moment, I will do that once the file in update is corrected.
Yes, please wait until the new corrected version is available in the update system,
this might take some time as we have limited access to the office at the moment.
Thanks!
Leigh

Brendan
Posts: 243
Joined: Tue Nov 27, 2012 12:53 pm
Location: Cambridge, UK
Has thanked: 140 times
Been thanked: 118 times
Contact:

Re: Bug: round function causes compile error.

Post by Brendan »

Hi Team.

Just advising that the compile bug with the FP rounding function still exists.

Many thanks,
Brendan

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times

Re: Bug: round function causes compile error.

Post by LeighM »

Looks like the updated PIC CAL file is now in the update system OK.
Can you check you are up to date?
If you still have an error could you please post a sample program demonstrating the issue that you have?
Thanks

Brendan
Posts: 243
Joined: Tue Nov 27, 2012 12:53 pm
Location: Cambridge, UK
Has thanked: 140 times
Been thanked: 118 times
Contact:

Re: Bug: round function causes compile error.

Post by Brendan »

Thanks Leigh.

Coding for the PIC32MZ, I created the following FP vars:

.TempFP
_Deg_C_Top_Float

and a compile error results should I use the following in a calculation:

.TempFP = fround (_Deg_C_Top_Float,2)

Commenting out the above and creating a workaround then builds without issue.

My first thoughts were to check for updates (which I applied this morning for the full database), but still no joy.

Quick example project:
Flowcode_Float2Int_Issue.fcfx
(6.59 KiB) Downloaded 251 times

Best regards,
Brendan

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times

Re: Bug: round function causes compile error.

Post by LeighM »

Thanks for the spot.
Please try the attached, to go into ...
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC32BIT
Attachments
PIC32BIT_CAL_Float.c
(4.19 KiB) Downloaded 193 times

Brendan
Posts: 243
Joined: Tue Nov 27, 2012 12:53 pm
Location: Cambridge, UK
Has thanked: 140 times
Been thanked: 118 times
Contact:

Re: Bug: round function causes compile error.

Post by Brendan »

Thank you Liam for your support and early reply.

That worked 😁👍

Best regards,
Brendan

Post Reply