Difference between revisions of "Mathematical Functions"

From Flowcode Help
Jump to navigationJump to search
Line 52: Line 52:
 
|-
 
|-
 
| fabs( x ), floor( x ), ceil( x )
 
| fabs( x ), floor( x ), ceil( x )
| absolute value, floor and ceiling functions
+
| Absolute value, floor and ceiling functions
 
|-
 
|-
 
| fmod( x , y )
 
| fmod( x , y )
| floating point modulus (remainder of x divided by y)
+
| Floating point modulus (remainder of x divided by y)
 
|-
 
|-
 
| sqrt( x ), cbrt( x )
 
| sqrt( x ), cbrt( x )
| square and cube roots
+
| Square and cube roots
 
|-
 
|-
 
| log( x ), log10( x )
 
| log( x ), log10( x )
| logarithms (base e and base 10)
+
| Logarithms (base e and base 10)
 
|-
 
|-
 
| exp( x ), pow( x , y )
 
| exp( x ), pow( x , y )
|exponential and power functions (x to the power of y)
+
| Exponential and power functions (x to the power of y)
 
|-
 
|-
 
| sin( x ), cos( x ), tan( x )
 
| sin( x ), cos( x ), tan( x )
| trigonometric functions
+
| Trigonometric functions
 
|-
 
|-
 
| asin( x ), acos( x ), atan( x )
 
| asin( x ), acos( x ), atan( x )
| inverse trigonometric functions             
+
| Inverse trigonometric functions             
 
|-
 
|-
 
| atan2( y , x )
 
| atan2( y , x )
| four-quadrant inverse tangent
+
| Four-quadrant inverse tangent
 
|-
 
|-
 
| sinh( x ), cosh( x ), tanh( x )
 
| sinh( x ), cosh( x ), tanh( x )
| hyperbolic functions
+
| Hyperbolic functions
 
|-
 
|-
 
| isnan( x ), isinf( x )
 
| isnan( x ), isinf( x )
| tests for not-a-number and infinity
+
| Tests for not-a-number and infinity
 
|-
 
|-
 
| round( x )
 
| round( x )
| decimal rounding (x rounded to the nearest integer)
+
| Decimal rounding (x rounded to the nearest integer)
 
|-
 
|-
 
| fround( x , y )
 
| fround( x , y )
| floating point rounding (x rounded to y decimal places)
+
| Floating point rounding (x rounded to y decimal places)
 
|-
 
|-
 
| asinh( x ), acosh( x ), atanh( x )
 
| asinh( x ), acosh( x ), atanh( x )
| inverse hyperbolic functions
+
| Inverse hyperbolic functions
 
|-
 
|-
 
| fact( x )
 
| fact( x )
| factorial
+
| Factorial
 
|-
 
|-
 
| random( )
 
| random( )
| random number between 0 and 32767
+
| Random number between 0 and 32767
 
|}
 
|}

Revision as of 14:14, 7 August 2013

<sidebar>Sidebar: Editing Icon Properties</sidebar> 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 -32768 <=> 32767
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
random( ) Random number between 0 and 32767