Difference between revisions of "Mathematical Functions"

From Flowcode Help
Jump to navigationJump to search
(Created page with " The following mathematical functions can be used in calculations. Some are limited to different chip types. Functions (Flowcode PIC only) Flowcode includes an additional s...")
 
 
(24 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
<sidebar>Sidebar: Flowcode Help Overview:Functions</sidebar>
 +
:''See [[Calculation Icon Properties]]''
  
 +
The following mathematical functions can be used in calculations. All of these functions are now usable on each chip type.
  
  
The following mathematical functions can be used in calculations. Some are limited to different chip types.
+
'''Functions'''
  
Functions (Flowcode PIC only)
 
 
Flowcode includes an additional set of mathematical functions:
 
Flowcode includes an additional set of mathematical functions:
  
float = fadd(float, float) - Add two floating point numbers together
+
{| class="wikitable" style="margin:auto; width:700px;"
float = fsub(float, float) - Subtract two floating point numbers
+
|-
float = fmul(float, float) - Multiply two floating point numbers
+
! scope="col" width="30%" | Function Prototype
float = fdiv(float, float) - Divide two floating point numbers
+
! scope="col" width="70%" | Description
float = fmod(float, float) - MOD function for floating point numbers
+
|-
byte = isinf(float) - Checks to see if the floating point number is infinite
+
| align="center" | float = fadd(float, float)
byte = isnan(float) - Checks to see if the floating point is not a number
+
| Add two floating point numbers together
byte = float_eq(float, float) - Compares two floating point numbers to see if they are equal
+
|-
byte = float_ge(float, float) - Compares two floating point numbers to see if they are greater then or equal
+
| align="center" | float = fsub(float, float)
byte = float_gt(float, float) - Compares two floating point numbers to see if they are greater then
+
| Subtract two floating point numbers
byte = float_le(float, float) - Compares two floating point numbers to see if they are less then or equal
+
|-
byte = float_lt(float, float) - Compares two floating point numbers to see if they are less then
+
| align="center" | float = fmul(float, float)
int = random()   - Generates a random number -32768 <=> 32767
+
| Multiply two floating point numbers
 
+
|-
 
+
| align="center" | float = fdiv(float, float)
Functions (Flowcode AVR only)
+
| Divide two floating point numbers
Flowcode includes an additional set of mathematical functions:
+
|-
 
+
| align="center" | float = fmod(float, float)
fabs( x ), floor( x ), ceil( x ) - absolute value, floor and ceiling functions
+
| MOD function for floating point numbers
fmod( x , y )                         - floating point modulus (remainder of x divided by y)
+
|-
sqrt( x ), cbrt( x )                 - square and cube roots
+
| align="center" | byte = isinf(float)
log( x ), log10( x )                 - logarithms (base e and base 10)
+
| Checks to see if the floating point number is infinite
exp( x ), pow( x , y )               - exponential and power functions (x to the power of y)
+
|-
sin( x ), cos( x ), tan( x )       - trigonometric functions
+
| align="center" | byte = isnan(float)
asin( x ), acos( x ), atan( x ),      - inverse trigonometric functions             
+
| Checks to see if the floating point is not a number
atan2( y , x )                       - four-quadrant inverse tangent
+
|-
sinh( x ), cosh( x ), tanh( x )       - hyperbolic functions
+
| align="center" | byte = float_eq(float, float)
isnan( x ), isinf( x )               - tests for not-a-number and infinity
+
| Compares two floating point numbers to see if they are equal
 
+
|-
 
+
| align="center" | byte = float_ge(float, float)
Functions (Flowcode ARM only)
+
| Compares two floating point numbers to see if they are greater then or equal&nbsp;&nbsp;&nbsp;
Flowcode includes an additional set of mathematical functions:
+
|-
 
+
| align="center" | byte = float_gt(float, float)
fabs( x ), floor( x ), ceil( x ) - absolute value, floor and ceiling functions
+
| Compares two floating point numbers to see if they are greater then
round( x )                         - decimal rounding (x rounded to the nearest integer)
+
|-
fround( x , y )                       - floating point rounding (x rounded to y decimal places)
+
| align="center" | byte = float_le(float, float)
fmod( x , y )                        - floating point modulus (remainder of x divided by y)
+
| Compares two floating point numbers to see if they are less then or equal
sqrt( x ), cbrt( x )                  - square and cube roots
+
|-
log( x ), log10( x )                  - logarithms (base e and base 10)
+
| align="center" | byte = float_lt(float, float)
exp( x ), pow( x , y )                - exponential and power functions (x to the power of y)
+
| Compares two floating point numbers to see if they are less then
sin( x ), cos( x ), tan( x )        - trigonometric functions
+
|-
asin( x ), acos( x ), atan( x ),      - inverse trigonometric functions           
+
| align="center" | int = random()
atan2( y , x )                        - four-quadrant inverse tangent
+
| Generates a random number 0x0000 <=> 0xFFFF
sinh( x ), cosh( x ), tanh( x )        - hyperbolic functions
+
|-
asinh( x ), acosh( x ), atanh( x )  - inverse hyperbolic functions
+
| align="center" | fabs( x ), floor( x ), ceil( x )
fact( x )                             - factorial
+
| Absolute value, floor and ceiling functions
random( )                            - random number between 0 and 32767
+
|-
isnan( x ), isinf( x )                - tests for not-a-number and infinity
+
| align="center" | fmod( x , y )
 +
| Floating point modulus (remainder of x divided by y)
 +
|-
 +
| align="center" | sqrt( x ), cbrt( x )
 +
| Square and cube roots
 +
|-
 +
| align="center" | log( x ), log10( x )
 +
| Logarithms (base e and base 10)
 +
|-
 +
| align="center" | exp( x ), pow( x , y )
 +
| Exponential and power functions (x to the power of y)
 +
|-
 +
| align="center" | sin( x ), cos( x ), tan( x )
 +
| Trigonometric functions
 +
|-
 +
| align="center" | asin( x ), acos( x ), atan( x )
 +
| Inverse trigonometric functions             
 +
|-
 +
| align="center" | atan2( y , x )
 +
| Four-quadrant inverse tangent
 +
|-
 +
| align="center" | sinh( x ), cosh( x ), tanh( x )
 +
| Hyperbolic functions
 +
|-
 +
| align="center" | isnan( x ), isinf( x )
 +
| Tests for not-a-number and infinity
 +
|-
 +
| align="center" | round( x )
 +
| Decimal rounding (x rounded to the nearest integer)
 +
|-
 +
| align="center" | fround( x , y )
 +
| Floating point rounding (x rounded to y decimal places)
 +
|-
 +
| align="center" | asinh( x ), acosh( x ), atanh( x )
 +
| Inverse hyperbolic functions
 +
|-
 +
| align="center" | fact( x )
 +
| Factorial
 +
|}

Latest revision as of 08:44, 28 July 2015

<sidebar>Sidebar: Flowcode Help Overview:Functions</sidebar>

See Calculation Icon Properties

The following mathematical functions can be used in calculations. All of these functions are now usable on each chip type.


Functions

Flowcode includes an additional set of mathematical functions:

Function Prototype Description
float = fadd(float, float) Add two floating point numbers together
float = fsub(float, float) Subtract two floating point numbers
float = fmul(float, float) Multiply two floating point numbers
float = fdiv(float, float) Divide two floating point numbers
float = fmod(float, float) MOD function for floating point numbers
byte = isinf(float) Checks to see if the floating point number is infinite
byte = isnan(float) Checks to see if the floating point is not a number
byte = float_eq(float, float) Compares two floating point numbers to see if they are equal
byte = float_ge(float, float) Compares two floating point numbers to see if they are greater then or equal   
byte = float_gt(float, float) Compares two floating point numbers to see if they are greater then
byte = float_le(float, float) Compares two floating point numbers to see if they are less then or equal
byte = float_lt(float, float) Compares two floating point numbers to see if they are less then
int = random() Generates a random number 0x0000 <=> 0xFFFF
fabs( x ), floor( x ), ceil( x ) Absolute value, floor and ceiling functions
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
isnan( x ), isinf( x ) Tests for not-a-number and infinity
round( x ) Decimal rounding (x rounded to the nearest integer)
fround( x , y ) Floating point rounding (x rounded to y decimal places)
asinh( x ), acosh( x ), atanh( x ) Inverse hyperbolic functions
fact( x ) Factorial