@@ -84,6 +84,41 @@ local scope as any other variable. The same is true for more digits like `reg123
84
84
Same as with gmegabuf, global variables are not necessarily ` 0 ` when a preset is initialized and they can change at any
85
85
time when two presets using the same global variables are blended during a transition.
86
86
87
+ ### Constants
88
+
89
+ All constants are converted into floating-point numbers internally, even if written as integers.
90
+
91
+ As with all other names, constant names (and hexadecimal values) are also case-insensitive.
92
+
93
+ #### Numerical Constants
94
+
95
+ Basic numerical/decimal constants can be defined in the code in the following formats:
96
+
97
+ - Integer values: ` 1 ` (or ` 1. ` )
98
+ - Decimal values: ` 1.234 ` (values between 0 and 1 can be abbreviated with ` .234 ` , which equals ` 0.234 ` )
99
+ - Base 10 exponential form: ` 1.234e5 ` equals ` 123400 ` and ` 1.234e-5 ` equals ` 0.00001234 `
100
+
101
+ #### Predefined Constants
102
+
103
+ A few named convenience constants can be used:
104
+
105
+ - ` $PI ` : Equals ` 3.141592653589793 `
106
+ - ` $E ` : Equals ` 2.71828183 `
107
+ - ` $PHI ` : Equals ` 1.61803399 `
108
+
109
+ #### Hexadecimal Constants
110
+
111
+ Hexadecimal constants start with ` $X ` , immediately followed by the hexadecimal numbers.
112
+
113
+ Example: ` $XFF ` converts to ` 255 ` .
114
+
115
+ #### Character (Ordinal) Constants
116
+
117
+ Constants can also convert a single character into its ordinal (ASCII) value using the form ` $'c' ` , where ` c ` is the
118
+ character to convert.
119
+
120
+ Example: ` $'a' ` converts to ` 97 ` .
121
+
87
122
### Operator Precedence
88
123
89
124
Operator precedence is defined in a similar way as in C, with the expection of the ` ^ ` operator, which has a different
0 commit comments