Difference between revisions of "Mathematical Functions"

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