Math: All Functions in math job version 1.1 (0x11)
From bab-tec.de wiki
Mathematical Operations:
| Symbol | Description |
|---|---|
| + | Addition (resp. stringing together) |
| - | Subtraction |
| * | Multiplication |
| / | Division (real numbers) |
| % | Modulo (rest of an integer division) |
| & | bit by bit AND operation |
| | | bit by bit OR operation |
| ^ | exponentiate |
Logical (boolean) operations
| Symbol | Description |
|---|---|
| || | logical OR |
| && | Logical AND |
| > | Comparison operation "Greater than" |
| >= | Comparison operation "Greater than or equal" |
| < | Comparison operation "Less than" |
| <= | Comparison operation "Less or equal" |
| == | Comparison operation "equality" |
Bitwise operations
| Symbol | Description |
|---|---|
| << | Shift left by x places (result = 0x01 << 3 // the result is 0x08) |
| >> | Shift right by x places (result = 0x08 >> 3 // the result is 0x01) |
| & | Bitwise AND (get LSB: result = 0x05 & 0x01) |
| | | Bitwise OR (set LSB: result = 0x04 | 0x01) |
| ^ | Exclusive OR (result = 0x03 ^ 0x01 // the result is 0x02) |
| ~ | Binary invert (result = ~0x07 // the result is 0x08) |
Ohter operations
| Symbol | Description |
|---|---|
| = | Assignment |
| '(' and ')' | Parenthesis for changing the operation process |
Built in functions
| Symbol | Description |
|---|---|
| sqrt(x) | Square root calculation |
| sin(x) | Sine calculation |
| cos(x) | Cosine calculation |
| tan(x) | Tangens calculation |
| max(x,...) | Maximum determination of an (finite) amount of values |
| min(x,...) | Minimum determination of an (finite) amount of values |
| rad(x) | Conversion from degrees into radian (sheet calculation) |
| asin(x) | arc sine calculation |
| acos(x) | arc cosine calculation |
| atan(x) | arcus tangens calculation |
| ceil(x) | Calculation of the smallest integer values, which is not smaller than the argument ("round off") |
| floor(x) | Calculation of the largest integer values, which is not larger than the argument ("round down") |
| abs(x) | Calculation of the absolute value of an argument |
| exp(x) | Calculation of the base 'e' exponential function (euler's constant) |
| log10(x) | Calculation of the base 10 logarithm |
| pow(x,y) | Exponential function is calculating x^y |
| time() | Ist giving out the system time in seconds from the beginning of the era (00:00:00 UTC, January 1, 1970) |
| srand(x) | Is setting the (pseudo-)random generator to a definated start value |
| rand() | Delivers the next random value |
| eo_sum(x,...) | Adds the KNX-objects with the numbers according to the arguments |
| int(x) | Is cutting off the real number and delivers only the integer value |
| modf(x) | Delivers the decimal point of a real number (the places behind the decimal point) |
| round(x) | Delivers a correct rounded integer of an real argument |
| round(x, n) | Delivers a rounded value with n decimal places |
Number types and strings:
| Types | Notation |
|---|---|
| Integer number | 42 |
| Hexadecimal number | 0x12ab |
| Real number | 1.23 |
| Exponential number | 1.23e3 für 1.23 * 10^3 oder 1023.0 |
| String | "text" |
Predefined constant:
| Symbol | Description |
|---|---|
| M_PI | The constant Pi (3.14.....) |
| M_E | The euler's constant (Base of the natural logarithm) |
| M_LOG2E | Base 2 logarithm of 'e' |
| M_LOG10E | Base 10 logarithm of 'e' |
| M_LN2 | Natural logarithm of 2 |
| M_LN10 | Natural logarithm of 10 |
| M_PI_2 | Pi divided by 2 ("Pi-half") |
| M_PI_4 | Pi divided by 4 ("Pi-quarter") |
| M_1_PI | Reciprocal value of Pi (1 divided by Pi) |
| M_2_PI | 2 times 1 divided by Pi |
| M_2_SQRTPI | 2 times 1 divided by root of Pi |
| M_SQRT2 | Root of 2 |
| M_SQRT1_2 | Reciprocal of squareroot (resp. root of 1/2) |