You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: TinyExprChanges.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,11 +34,12 @@ The following are changes from the original TinyExpr C library:
34
34
-`and`: returns true (i.e., non-zero) if all conditions are true (accepts 1-7 arguments).
35
35
-`average`: returns the mean for a range of values (accepts 1-7 arguments).
36
36
-`bitand`: bitwise AND.
37
-
-`bitlrotate64`: bitwise (`uint64_t`) left rotate. (Only available if compiled as C++20.)
37
+
-`bitlrotate`: bitwise left rotate. Versions of this are available for 8-, 16-, 32-, and 64-bit integers (if supported by the platform). (Only available if compiled as C++20.)
38
38
-`bitlshift`: left shift.
39
39
Negative shift amount arguments (similar to *Excel*) are supported.
40
+
-`bitnot`: bitwise NOT. Versions of this are available for 8-, 16-, 32-, and 64-bit integers (if supported by the platform).
40
41
-`bitor`: bitwise OR.
41
-
-`bitrrotate64`: bitwise (`uint64_t`) right rotate. (Only available if compiled as C++20.)
42
+
-`bitrrotate`: bitwise right rotate. Versions of this are available for 8-, 16-, 32-, and 64-bit integers (if supported by the platform). (Only available if compiled as C++20.)
42
43
-`bitrshift`: right shift.
43
44
Negative shift amount arguments (similar to *Excel*) are supported.
44
45
-`bitxor`: bitwise XOR.
@@ -87,6 +88,7 @@ The following are changes from the original TinyExpr C library:
87
88
-`<<<` left (`uint64_t`) rotation operator.
88
89
-`>>>` right (`uint64_t`) rotation operator.
89
90
-`**` exponentiation (alias for `^`).
91
+
-`~` bitwise NOT.
90
92
-`round` now supports negative number of digit arguments, similar to *Excel*.
91
93
For example, `ROUND(-50.55,-2)` will yield `-100`.
92
94
- Custom variables and functions are now stored in a `std::set`
Copy file name to clipboardExpand all lines: docs/manual/functions.qmd
+17-5Lines changed: 17 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -52,19 +52,26 @@ Table: Math Functions\index{functions!math}
52
52
| BITLROTATE8(Number, RotateAmount) | Returns *Number* left rotated left to the most significant bit by the specified number (*RotateAmount*) of bits.<br>\linebreak *Number* is rotated as an unsigned 8-bit integer.<br>\linebreak (Only available if compiled as C++20.) |
53
53
| BITLROTATE16(Number, RotateAmount) | Returns *Number* left rotated left to the most significant bit by the specified number (*RotateAmount*) of bits.<br>\linebreak *Number* is rotated as an unsigned 16-bit integer.<br>\linebreak (Only available if compiled as C++20.) |
54
54
| BITLROTATE32(Number, RotateAmount) | Returns *Number* left rotated left to the most significant bit by the specified number (*RotateAmount*) of bits.<br>\linebreak *Number* is rotated as an unsigned 32-bit integer.<br>\linebreak (Only available if compiled as C++20.) |
55
-
| BITLROTATE(Number, RotateAmount) | Returns *Number* left rotated left to the most significant bit by the specified number (*RotateAmount*) of bits.<br>\linebreak *Number* is rotated as an unsigned 53-bit (or 64-bit) integer.<br>\linebreak Note, however, that values beyond the range of `double` should not be used as they will wrap around.<br>\linebreak (Only available if compiled as C++20.) |
56
-
| BITLSHIFT(Number, ShiftAmount) | Returns *Number* left shifted by the specified number (*ShiftAmount*) of bits.<br>\linebreak *Number* cannot exceed `(2^48)-1` and *ShiftAmount* cannot exceed `53` (or `64`, if supported). |
55
+
| BITLROTATE64(Number, RotateAmount) | Returns *Number* left rotated left to the most significant bit by the specified number (*RotateAmount*) of bits.<br>\linebreak *Number* is rotated as an unsigned 64-bit integer.<br>\linebreak (Only available if compiled as C++20.) |
56
+
| BITLROTATE(Number, RotateAmount) | Returns *Number* left rotated left to the most significant bit by the specified number (*RotateAmount*) of bits.<br>\linebreak *Number* is rotated as either a 32- or 64-bit integer (depending on what is supported by the compiler).<br>\linebreak (Only available if compiled as C++20.) |
57
+
| BITLSHIFT(Number, ShiftAmount) | Returns *Number* left shifted by the specified number (*ShiftAmount*) of bits.<br>\linebreak *Number* cannot exceed `(2^48)-1` and *ShiftAmount* cannot exceed `53` (or `63`, if 64-bit is supported). |
58
+
| BITNOT8(Number) | Returns a bitwise 'NOT' of a 8-bit integer. |
59
+
| BITNOT16(Number) | Returns a bitwise 'NOT' of a 16-bit integer. |
60
+
| BITNOT32(Number) | Returns a bitwise 'NOT' of a 32-bit integer. |
61
+
| BITNOT64(Number) | Returns a bitwise 'NOT' of a 64-bit integer (if 64-bit integers are supported). |
62
+
| BITNOT(Number) | Returns a bitwise 'NOT' of a 32- or 64-bit integer (depending on whether 64-bit is supported). |
57
63
| BITOR(Number1, Number2) | Returns a bitwise 'OR' of two (integral) numbers. (Both numbers must be positive and cannot exceed `(2^48)-1`.) |
58
64
| BITRROTATE8(Number, RotateAmount) | Returns *Number* right rotated right to the least significant bit by the specified number (*RotateAmount*) of bits.<br>\linebreak *Number* is rotated as an unsigned 8-bit integer.<br>\linebreak (Only available if compiled as C++20.) |
59
65
| BITRROTATE16(Number, RotateAmount) | Returns *Number* right rotated right to the least significant bit by the specified number (*RotateAmount*) of bits.<br>\linebreak *Number* is rotated as an unsigned 16-bit integer.<br>\linebreak (Only available if compiled as C++20.) |
60
66
| BITRROTATE32(Number, RotateAmount) | Returns *Number* right rotated right to the least significant bit by the specified number (*RotateAmount*) of bits.<br>\linebreak *Number* is rotated as an unsigned 32-bit integer.<br>\linebreak (Only available if compiled as C++20.) |
61
-
| BITRROTATE(Number, RotateAmount) | Returns *Number* right rotated right to the least significant bit by the specified number (*RotateAmount*) of bits.<br>\linebreak *Number* is rotated as an unsigned 53-bit (or 64-bit) integer.<br>\linebreak Note, however, that values beyond the range of `double` should not be used as they will wrap around.<br>\linebreak (Only available if compiled as C++20.) |
62
-
| BITRSHIFT(Number, ShiftAmount) | Returns *Number* right shifted by the specified number (*ShiftAmount*) of bits.<br>\linebreak *Number* cannot exceed `(2^48)-1` and *ShiftAmount* cannot exceed `53` (or `64`, if supported). |
67
+
| BITRROTATE64(Number, RotateAmount) | Returns *Number* right rotated right to the least significant bit by the specified number (*RotateAmount*) of bits.<br>\linebreak *Number* is rotated as an unsigned 64-bit integer.<br>\linebreak (Only available if compiled as C++20.) |
68
+
| BITRROTATE(Number, RotateAmount) | Returns *Number* right rotated right to the least significant bit by the specified number (*RotateAmount*) of bits.<br>\linebreak *Number* is rotated as either a 32- or 64-bit integer (depending on what is supported by the compiler).<br>\linebreak (Only available if compiled as C++20.) |
69
+
| BITRSHIFT(Number, ShiftAmount) | Returns *Number* right shifted by the specified number (*ShiftAmount*) of bits.<br>\linebreak *Number* cannot exceed `(2^48)-1` and *ShiftAmount* cannot exceed `53` (or `63`, if 64-bit is supported). |
63
70
| BITXOR(Number1, Number2) | Returns a bitwise 'XOR' of two (integral) numbers. (Both numbers must be positive and cannot exceed `(2^48)-1`.) |
64
71
| SUPPORTS32BIT() | Returns true if 32-bit integers are supported. This will affect the supported range of values for bitwise operations. |
65
72
| SUPPORTS64BIT() | Returns true if 64-bit integers are supported. This will affect the supported range of values for bitwise operations. |
Copy file name to clipboardExpand all lines: docs/manual/operators.qmd
+13-8Lines changed: 13 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ The following operators\index{operators} are supported within math expressions:
10
10
| % | Modulus: Divides two values and returns the remainder. |
11
11
| + | Addition. |
12
12
|\-| Subtraction. |
13
-
| ^ | Either exponentiation or bitwise XOR. Exponentiation is the default; define `TE_BITWISE_OPERATORS` to enable bitwise behavior. For exponentiation, the number in front of ^ is the base, the number after it is the power to raise it to. |
13
+
| ^ | Either exponentiation (the default) or bitwise XOR. For exponentiation, the number in front of ^ is the base, the number after it is the power to raise it to. |
14
14
|**| Exponentiation. (This is an alias for ^) |
15
15
| < | Less than. |
16
16
|\>| Greater than. |
@@ -20,26 +20,31 @@ The following operators\index{operators} are supported within math expressions:
20
20
|\=\=| Equals. (This is an alias for \=) |
21
21
| <> | Not equal to. |
22
22
|\!\=| Not equal to. (This is an alias for <>) |
23
-
| & | Either logical or bitwise conjunction (AND). Logical is the default, define `TE_BITWISE_OPERATORS` to enable bitwise behavior. |
24
-
| && | Either logical conjunction (AND). |
25
-
|\||Logical or bitwise alternative (OR). Logical is the default, define `TE_BITWISE_OPERATORS` to enable bitwise behavior. |
26
-
|\|\|| Logical alternative (OR). |
23
+
| & | Either logical (the default) or bitwise conjunction (AND). |
24
+
| && | Logical conjunction (AND). |
25
+
|\|| Either Logical (the default) or bitwise alternative (OR). |
26
+
|\|\|| Logical alternative (OR). |
27
27
| ( ) | Groups sub-expressions, overriding the order of operations. |
28
-
| << | Bitwise left shift. |
29
-
| >> | Bitwise right shift. |
28
+
| ~ | Bitwise NOT. |
29
+
| << | Bitwise left shift. |
30
+
| >> | Bitwise right shift. |
30
31
| <<< | Bitwise left rotate. (Only available if compiled as C++20.) |
31
32
| >>> | Bitwise right rotate. (Only available if compiled as C++20.) |
32
33
33
34
Table: Operators
34
35
:::
35
36
37
+
::: {.tipsection data-latex=""}
38
+
Define `TE_BITWISE_OPERATORS` to enable bitwise behavior for `&`, `|`, and `^`.
39
+
:::
40
+
36
41
::: {.minipage data-latex="{\textwidth}"}
37
42
For operators, the order of precedence is:
38
43
39
44
| Operator | Description |
40
45
| :-- | :-- |
41
46
| ( ) | Instructions in parentheses are executed first. (If `TE_BRACKETS_AS_PARENS` is defined, then `[]` are treated the same way.) |
42
-
|\+ and - | Positive or negative sign for a value. |
47
+
|\+, -, ~ | Positive or negative sign for a value, and bitwise NOT. |
43
48
| ^ | Exponentiation. |
44
49
|\*, /, and % | Multiplication, division, and modulus. |
0 commit comments