ARM V5 error compiling floor function

Moderator: Benj

Post Reply
User avatar
Mantas
Posts: 221
Joined: Tue May 15, 2012 10:32 pm
Location: Klaipeda, Lithuania - North sea, UK
Has thanked: 57 times
Been thanked: 27 times
Contact:

ARM V5 error compiling floor function

Post by Mantas »

Hello support,

just got my hands on new version, and imported a project from v4 ARM. When I am trying to simulate or compile I get an error saying "unknown or missing function: floor". Crearly the function is there in the list and it is writen (used) correctly, it was working in v4. Maybe you can investigate this error.

Best regards,
Mantas
Science is my true religion.

User avatar
DavidA
Matrix Staff
Posts: 1076
Joined: Fri Apr 23, 2010 2:18 pm
Location: Matrix Multimedia Ltd
Has thanked: 58 times
Been thanked: 258 times
Contact:

Re: ARM V5 error compiling floor function

Post by DavidA »

Hello Mantas,

Can you post a fcf file which exhibits this behaviour for us?

User avatar
JonnyW
Posts: 1230
Joined: Fri Oct 29, 2010 9:13 am
Location: Matrix Multimedia Ltd
Has thanked: 63 times
Been thanked: 290 times
Contact:

Re: ARM V5 error compiling floor function

Post by JonnyW »

Hello. Don't worry about posting the fcf - I know the problem. I'm afraid the function has been lost in the v5 build, along with ceil() and round() - I have added support for it now and it will be rolled in the next release.

There are the following possible workarounds:
  • Instead of calling floor(f), assign your float to an int and back to a float: i = f
  • Instead of calling floor(f), do the calculation f = f - fmod (f,1)
  • Create a macro called 'floor' and add the above code to this
I would lean to option 3 here, so have created a flowchart macro for you that you can import (Menu->Macro->Import...). This will mean your programs work correctly. Note this will override the built-in version of the function when called. I have tested this on the PIC and it works OK - it should also work on the ARM no problems.
float_floor.fcm
Replacement floor()
(1.97 KiB) Downloaded 263 times
Cheers,

Jonny

User avatar
Mantas
Posts: 221
Joined: Tue May 15, 2012 10:32 pm
Location: Klaipeda, Lithuania - North sea, UK
Has thanked: 57 times
Been thanked: 27 times
Contact:

Re: ARM V5 error compiling floor function

Post by Mantas »

Unfortunately when I imported the macro, i get windows error, "program stopped working correctly, bla bla bla"...i will try to use the other workarounds for now, but I am waiting for a fix update.

Best regards,
Mantas
Science is my true religion.

User avatar
JonnyW
Posts: 1230
Joined: Fri Oct 29, 2010 9:13 am
Location: Matrix Multimedia Ltd
Has thanked: 63 times
Been thanked: 290 times
Contact:

Re: ARM V5 error compiling floor function

Post by JonnyW »

Hi. Are you definitely using the Menu->Macro->Import... option? It seems to work OK testing here so I can't explain this.

Anyway, all the macro is is a macro called 'floor' that has a floating point argument called 'value' and a return type of float. The only code is the following text in a calculation icon:

Code: Select all

.Return = .value - fmod (.value,1)
If you would like to add this manually it should work fine.

Jonny

User avatar
Mantas
Posts: 221
Joined: Tue May 15, 2012 10:32 pm
Location: Klaipeda, Lithuania - North sea, UK
Has thanked: 57 times
Been thanked: 27 times
Contact:

Re: ARM V5 error compiling floor function

Post by Mantas »

Yes I used macro import function. I tried creating new project and do the calculations in the calc box, and it worked fine, just that v4 project is still not working, and the flowcode crashes...very strange :?

Regards,
Mantas
Science is my true religion.

User avatar
JonnyW
Posts: 1230
Joined: Fri Oct 29, 2010 9:13 am
Location: Matrix Multimedia Ltd
Has thanked: 63 times
Been thanked: 290 times
Contact:

Re: ARM V5 error compiling floor function

Post by JonnyW »

Hi. If you post your flowcode file (or PM me with it) I can take a look and maybe find out why it crashes - I'm puzzled why this would crash.

Barring that, adding that macro manually into any Flowcode v5 program should behave as expected.

Jonny

Post Reply