math ability

Any general or miscellaneous queries that do not fit into the other forum catagories

Moderators: Benj, Mods

Post Reply
tinker
Flowcode V4 User
Posts: 8
Joined: Mon Jul 02, 2007 9:35 am
Contact:

math ability

Post by tinker »

Hi all
is there a list specifying what math functions are available in flowcode ?

cheers
joe

User avatar
Benj
Matrix Staff
Posts: 14843
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: math ability

Post by Benj »

Hi Joe

Here is the list of functions taken from the latest help file.

( ) - Parentheses.
= <> -Equal to, Not equal to.
+ - * / MOD - Addition, Subtraction, Multiplication, Division & Modulus.
< <= > >= - Less than, Less than or equal to, Greater than, Greater than or equal to.
>> << - Shift right, Shift left.
NOT AND OR XOR - NOT(inversion), AND, OR, Exclusive OR


Functions (Flowcode for ARM only)
Flowcode includes an additional set of mathematical functions:

fabs( x ), floor( x ), ceil( x ) - absolute value, floor and ceiling functions
round( x ) - decimal rounding (x rounded to the nearest integer)
fround( x , y ) - floating point rounding (x rounded to y decimal places)
fmod( x , y ) - floating point modulus (remainder of x divided by y)
sqrt( x ), cbrt( x ) - square and cube roots
log( x ), log10( x ) - logarithms (base e and base 10)

exp( x ), pow( x , y ) - exponential and power functions (x to the power of y)
sin( x ), cos( x ), tan( x ) - trigonometric functions
asin( x ), acos( x ), atan( x ), - inverse trigonometric functions
atan2( y , x ) - four-quadrant inverse tangent
sinh( x ), cosh( x ), tanh( x ) - hyperbolic functions
asinh( x ), acosh( x ), atanh( x ) - inverse hyperbolic functions
fact( x ) - factorial

random( ) - random number between 0 and 32767
isnan( x ), isinf( x ) - tests for not-a-number and infinity

hefin
Posts: 1
Joined: Sun Aug 31, 2014 9:40 pm
Contact:

Re: math ability

Post by hefin »

I've just downloaded the trial version of Flowcode v6.I tried to use the Calculation component but got a compiling error when I entered tanh().Simmilarly with sinh()
Why is this?
I circumvented the problem by the successful use of exp(). Is this an intended limitation of the trial version?

User avatar
Benj
Matrix Staff
Posts: 14843
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: math ability

Post by Benj »

I've just downloaded the trial version of Flowcode v6.I tried to use the Calculation component but got a compiling error when I entered tanh().Simmilarly with sinh()
Why is this?
I circumvented the problem by the successful use of exp(). Is this an intended limitation of the trial version?
The 8-bit PIC version of Flowcode supports Float variables but not the float functions such as tan and tanh. We are currently looking into switching compilers for 8-bit PIC to remove this problem.

All other variants of Flowcode, ARM, AVR and 16-bit PIC should work fine with the floating point functions.

stuart randall
Posts: 4
Joined: Sun Mar 01, 2015 2:07 pm
Contact:

Re: math ability

Post by stuart randall »

Hi Ben, this is something I'm having trouble with now. I see that its been about 6 months with this post and I was wondering if there have been any developments with it?

Thanks

User avatar
Benj
Matrix Staff
Posts: 14843
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: math ability

Post by Benj »

Hello Stuart,

No this compiler change has now been pushed back to Flowcode 7 which is still a fair way off. Can you switch to another microcontroller family for now?

stuart randall
Posts: 4
Joined: Sun Mar 01, 2015 2:07 pm
Contact:

Re: math ability

Post by stuart randall »

I could do. I'm currently using a 16F1937. Is there a similar device you can recommend?

User avatar
Benj
Matrix Staff
Posts: 14843
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: math ability

Post by Benj »

Hello Stuart,

How about a ATMEGA328P (chip used commonly on Arduino) or a dsPIC33EP device (same family as we use on the ECIO40P16 device).

Post Reply